TensorFlow---基础---GFile

  使用TensorFlow的时候经常遇到 tf.gfile.exists()....

  关于gfile,一个googler是这样给出的解释:

The main roles of the tf.gfile module are:

  1. To provide an API that is close to Python's file objects, and

  2. To provide an implementation based on TensorFlow's C++ FileSystem API.

The C++ FileSystem API supports multiple file system implementations, including local files, Google Cloud Storage (using a gs:// prefix), and HDFS (using an hdfs:// prefix). TensorFlow exports these as tf.gfile so that you can uses these implementations for saving and loading checkpoints, writing TensorBoard logs, and accessing training data (among other uses). However, if all of your files are local, you can use the regular Python file API without any problem.

   大概意思是:

    1. 提供了一个处理Python文件类型的API

    2. 提供了一种基于TensorFlow的C++文件系统的API实现

   总之,就是为了更好的可扩展性(C++文件系统API支持多种文件系统的实现,比如本地文件,谷歌云、HDFS)。所以不管你底层是以上的那种文件系统,都是用gfile来进行文件操作就ok了! 当然如果你只是单机本地跑的话,那么直接使用普通的py下 file-API也是ok的!

 

转载于:https://www.cnblogs.com/luntai/p/6748877.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值