Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow: 'module' object has no attribute 'FixedLenFeature'

I was running through Google's Tensorflow's fully_connected_reader.py example (I have executed convert_to_record.py, and source code is here:

https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/how_tos/reading_data):

python fully_connected_reader.py 
I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcublas.so.7.0 locally
I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcudnn.so.6.5 locally
I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcufft.so.7.0 locally
I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcuda.so locally
I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcurand.so.7.0 locally
Traceback (most recent call last):
  File "fully_connected_reader.py", line 198, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "fully_connected_reader.py", line 194, in main
    run_training()
  File "fully_connected_reader.py", line 135, in run_training
    num_epochs=FLAGS.num_epochs)
  File "fully_connected_reader.py", line 114, in inputs
    image, label = read_and_decode(filename_queue)
  File "fully_connected_reader.py", line 62, in read_and_decode
    'image_raw': tf.FixedLenFeature([], tf.string),
AttributeError: 'module' object has no attribute 'FixedLenFeature'

Anyone got any idea? (it is running from the latest github version).

like image 625
Peter Teoh Avatar asked Dec 03 '22 15:12

Peter Teoh


1 Answers

If you are using TensorFlow 2.x, FixedLenFeature has moved from tf.FixedLenFeature into tf.io.FixedLenFeature.

The use of tf.FixedLenFeature was marked as deprecated in previous versions.

like image 104
Dylan Hogg Avatar answered Jan 08 '23 05:01

Dylan Hogg