tf.gfile 在 TensorFlow 中有什么作用? [英] What does tf.gfile do in TensorFlow?

查看:21
本文介绍了tf.gfile 在 TensorFlow 中有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过有人使用 tf.gfile 中的几个函数,例如 tf.gfile.GFiletf.gfile.Exists.我认为 tf.gfile 处理文件.但是,我一直无法找到官方文档以查看它提供的其他内容.

I've seen people using several functions from tf.gfile such as tf.gfile.GFile or tf.gfile.Exists. I have the idea that tf.gfile deals with files. However, I haven't been able to find the official documentation to see what else it offers.

如果你能帮助我就好了.

It'd be great if you could help me with it.

推荐答案

对于登陆这里的任何人,以下答案(由 googler)提供:为什么使用 tensorflow gfile?(用于文件 I/O)

For anyone landing here, the following answer was provided (by a googler) on: Why use tensorflow gfile? (for file I/O)

tf.gfile 模块的主要作用是:

The main roles of the tf.gfile module are:

  1. 提供一个接近 Python 的文件对象的 API,以及

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

提供基于 TensorFlow 的 C++ FileSystem API 的实现.

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 use 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.

这篇关于tf.gfile 在 TensorFlow 中有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆