Reputation: 1
can someone please help me with this error....I tried using tf.io.gfile instead of tf.gfile then to its not working
error shown is still the same
AttributeError: module 'tensorflow' has no attribute 'gfile'
Upvotes: 0
Views: 1297
Reputation:
tf.gfile is now submodule of tf.io, which you can use by giving an updated full alias name tf.io.gfile.GFile.
Please check below code for your reference:
import tensorflow as tf
print(tf.__version__)
with open("/tmp/x", "w") as f:
print(f.write("asdf"))
with tf.io.gfile.GFile("/tmp/x") as f: # <----using tf.io.gfile.GFile
print(f.read())
Output:
2.8.2
4
asdf
Upvotes: 1