LoginSignup
7
6

More than 5 years have passed since last update.

[TensorFlow] tf.gfile.GFile / tf.gfile.FastGFileの利点

Posted at

その前に : 両者は同じ

公式ドキュメントによると、 tf.gfile.GFiletf.gfile.FastGFile も以下のように同じ文言。

File I/O wrappers without thread locking.

ソースを見ても同じだし、github の Issues にも同様のコメントがあった。

本題 : tf.gfile.GFile / tf.gfile.FastGFileの利点

stackoverflow によると、tf.gfile.(Fast)GFile の役割は以下のようなものらしい。

  1. Python のファイルオブジェクトに近い API を提供し
  2. TensorFlown の C++ FileSystem API をベースにした実装を提供すること

すなわち、Google Clound Storage (gs://)Hadoop Distributed File System (hdfs://) をはじめとした様々なファイルシステムでデータセットやチェックポイントの読み書きが可能になっているそうだ。
なので、これらのファイルシステムを使うときは必須なのだろう(使ったことはない)。

ただ、上記 stackoverflow では、

in the case all my files are local will I get any computational advantage by using tf.gfile?

との質問に対し

No, probably not.

との回答もしているので、ローカルファイルだけを扱うのであれば Python 組み込みのファイル関数で代用してもよさそう。

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6