Tensorflow:“模块”对象没有“FixedLenFeature”属性

Pet*_*eoh 4 python tensorflow

我正在运行 Google 的 Tensorflow'sfully_connected_reader.py 示例(我已经执行了 convert_to_record.py,源代码在这里:

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'
Run Code Online (Sandbox Code Playgroud)

有人知道吗?(它从最新的 github 版本运行)。

Dyl*_*ogg 10

如果您正在使用TensorFlow 2.X,FixedLenFeature已经从移动tf.FixedLenFeature到tf.io.FixedLenFeature。

的使用tf.FixedLenFeature在以前的版本中被标记为已弃用。