为什么使用tensorflow gfile? (用于文件I/O) [英] Why use tensorflow gfile? (for file I/O)
问题描述
Tensorflow代码使用的文件I/O方法与python内置方法不同. 根据源代码,它很有用
Tensorflow code uses methods for file I/O that are different than python builtin methods. According to the source code, it is useful as
没有线程锁定的文件I/O包装器"
"File I/O wrappers without thread locking"
我不确定它在什么情况下有用,什么时候不应该使用.
I am not sure on what occasions it is useful and when it shouldn't be used.
有什么主意吗?
谢谢
推荐答案
此评论:
没有线程锁定的文件I/O包装器
File I/O wrappers without thread locking
...对TensorFlow的 tf.gfile
模块!
...is a particularly unhelpful description for TensorFlow's tf.gfile
module!
tf.gfile
模块的主要作用是:
- To provide an API that is close to Python's
file
objects, and - To provide an implementation based on TensorFlow's C++
FileSystem
API.
C ++ FileSystem
API支持多种文件系统实现,包括本地文件,Google Cloud Storage(使用gs://
前缀)和HDFS(使用hdfs://
前缀). TensorFlow将这些导出为tf.gfile
,以便您可以使用这些实现来保存和加载检查点,编写TensorBoard日志以及访问训练数据(除其他用途外).但是,如果所有文件都是本地文件,则可以正常使用Python文件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.
这篇关于为什么使用tensorflow gfile? (用于文件I/O)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!