使用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的!

TensorFlow---基础---GFile的更多相关文章

  1. TensorFlow基础

    TensorFlow基础 SkySeraph  2017 Email:skyseraph00#163.com 更多精彩请直接访问SkySeraph个人站点:www.skyseraph.com Over ...

  2. TensorFlow基础笔记(0) 参考资源学习文档

    1 官方文档 https://www.tensorflow.org/api_docs/ 2 极客学院中文文档 http://www.tensorfly.cn/tfdoc/api_docs/python ...

  3. TensorFlow基础笔记(3) cifar10 分类学习

    TensorFlow基础笔记(3) cifar10 分类学习 CIFAR-10 is a common benchmark in machine learning for image recognit ...

  4. TensorFlow基础剖析

    TensorFlow基础剖析 一.概述 TensorFlow 是一个使用数据流图 (Dataflow Graph) 表达数值计算的开源软件库.它使 用节点表示抽象的数学计算,并使用 OP 表达计算的逻 ...

  5. 05基于python玩转人工智能最火框架之TensorFlow基础知识

    从helloworld开始 mkdir mooc # 新建一个mooc文件夹 cd mooc mkdir 1.helloworld # 新建一个helloworld文件夹 cd 1.helloworl ...

  6. tensorflow基础篇-1

    1.使用占位符和变量 import tensorflow as tf import numpy as np #-----创建变量并初始化----------- def first(): my_var= ...

  7. TensorFlow基础笔记(14) 网络模型的保存与恢复_mnist数据实例

    http://blog.csdn.net/huachao1001/article/details/78502910 http://blog.csdn.net/u014432647/article/de ...

  8. TensorFlow基础笔记(9) Tensorboard可视化显示以及查看pb meta模型文件的方法

    参考: http://blog.csdn.net/l18930738887/article/details/55000008 http://www.jianshu.com/p/19bb60b52dad ...

  9. TensorFlow基础笔记(1) 数据读取与保存

    https://zhuanlan.zhihu.com/p/27238630 WholeFileReader # 我们用一个具体的例子感受tensorflow中的数据读取.如图, # 假设我们在当前文件 ...

  10. TensorFlow应用实战 | TensorFlow基础知识

    挺长的~超出估计值了~预计阅读时间20分钟. 从helloworld开始 mkdir 1.helloworld cd 1.helloworldvim helloworld.py 代码: # -*- c ...

随机推荐

  1. hdu - 1565 方格取数(1) && 1569 方格取数(2) (最大点权独立集)

    http://acm.hdu.edu.cn/showproblem.php?pid=1565 两道题只是数据范围不同,都是求的最大点权独立集. 我们可以把下标之和为奇数的分成一个集合,把下标之和为偶数 ...

  2. POJ——T 2728 Desert King

    http://poj.org/problem?id=2728 Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 27191   ...

  3. 洛谷——P2866 [USACO06NOV]糟糕的一天Bad Hair Day

    https://www.luogu.org/problem/show?pid=2866 题目描述 Some of Farmer John's N cows (1 ≤ N ≤ 80,000) are h ...

  4. springmvc @ResponseBody 乱码

    在spring配置文件中加入如下代码 <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMet ...

  5. html实现类似excel的复杂表格,及导出到excel

    1. excellentexport.js https://github.com/jmaister/excellentexport/tree/2.0.3 2.fiddle example  https ...

  6. Hadoop-mapreduce 程序在windows上执行需要注意的问题

    1.在主程序中需要添加这几个参数配置 Configuration conf = new Configuration(); // 1.设置job运行时要访问的默认文件系统 conf.set(" ...

  7. VC++ 提示无法打开包括文件“iostream.h”怎么办

    把 //#include "iostream.h" 改成 #include<iostream> using namespace std;                 ...

  8. ubuntu下vi的使用

    ubuntu下vi的使用 ssh之后对于server的文件,我习惯用gedit,可是不好改动,于是就用vi. 1.vi的基本概念 基本上vi能够分为三种状态,各自是命令模式(command mode) ...

  9. Linux学习日志--文件搜索命令

    开头总结: 学习了Linux中的文件搜索命令find和locate,系统搜索命令whereis 和which ,字符串搜索命令grep,find和locate的差别和使用方法格式,什么是path环境变 ...

  10. 划分问题(dp)

    给出一个整数集合  , 将这个集合分成2个 和相等的集合. 思路就是  总和的一半作为一个目标容量,在集合中寻找能否够有元素的和恰好为这个目标容量,也就转化为一个类似01背包问题. 这篇文章讲的比較具 ...