"ValueError: features should be a dictionary of `Tensor`s. Given type: <class 'tensorflow.python.data.ops.dataset_ops.BatchDataset'>"

运行https://www.tensorflow.org/get_started/get_started_for_beginners中的示例:

python premade_estimator.py

报错:

"ValueError: features should be a dictionary of `Tensor`s. Given type: <class 'tensorflow.python.data.ops.dataset_ops.BatchDataset'>"

 

原因是tensorflow 1.4版本的一个bug:https://github.com/tensorflow/models/issues/3331

 

如何查看tensorflow 版本,请参考:https://www.cnblogs.com/lixiaolun/p/9118828.html

 

 

解决办法有很多,我这里选择了升级tensorflow:

python2.*

pip install tensorflow

  

python3.*

pip3 install tensorflow

  

注:如果您是使用 virtualenv 或 Anaconda 安装的 TensorFlow,您是否激活了相应环境?

猜你喜欢

转载自www.cnblogs.com/lixiaolun/p/9118901.html