Python_io in tensorflow

Question:

I’m having trouble working with tensorflow. I want to use TFRecordWriter() as below:

with tf.python_io.TFRecordWriter(testing_filename) as tfrecord_writer:
    # do sth

but I get the error:

AttributeError: module ‘tensorflow’ has no attribute ‘python_io’

I’m working with tensorflow 1.2 and python 3.

How can I fix the problem?

Thanks.

Asked By: mohamad danesh

||

Answers:

I had this issue and it turned out to be a corrupt tensorflow installation. I removed tensor flow and reinstalled and it worked for me afterwards.

$ pip3 uninstall tensorflow
$ pip3 install tensorflow
Answered By: Krejko

The problem in the (python_io) :

with tf.python_io.TFRecordWriter(testing_filename) as tfrecord_writer:
# do sth

changed it to:

with tf.io.TFRecordWriter(testing_filename) as tfrecord_writer:
# do sth 
Answered By: Tofiq

Use this instead :

tf.python.python_io
Answered By: Sharaz Haider

it was in tensorflow v1 and there is no tf.python_io or tf.python in v2.
but still, you can use tf.compat.v1.python_io which is deprecated.

also, I would like to suggest you read the documents to use the new function instead of the deprecated ones.

Answered By: Kasra
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.