python - TensorFlow:NotFoundError:资源匿名迭代器错误
问题描述
我正在尝试复制在 https://www.tensorflow.org/beta/tutorials/text/time_series#multi-step_model上发布的在时间序列中使用 RNN 的示例
但是,我收到以下错误消息:
NotFoundError: Resource AnonymousIterator/AnonymousIterator3/class
tensorflow::data::IteratorResource does not exist.
[[{{node IteratorGetNext_3}}]]
当我尝试执行该行时:
for x, y in val_univariate.take(1):
print(simple_lstm_model.predict(x,steps=1).shape)
环境 :
Tenserflow : 2.0.0-beta1
Python : Python 3.6.7 Anaconda
OS : Windows 10 64-bit
有什么解决方案吗?
解决方案
来自TF 文档,
它指出:
创建一个迭代器,用于枚举该数据集的元素。
返回的迭代器实现了 Python 迭代器协议,因此只能在急切模式下使用。
所以你需要tf.enable_eager_execution()
在脚本的开头使用。
推荐阅读
- typescript - 量角器 - 将密钥发送到桌面应用程序 BankID
- python - Python空闲:不允许操作错误
- c# - C# 中的交互式时间表(用于家长控制)
- sql - 如何在 Postgresql 数据库表中插入带小数点的数字?
- android - 哪一种是Android中更好的设计方法 - 多个活动/片段
- java - MediaPlayer:ArrayList 出现错误 (1,-19)
- git - 如何检测标记提交合并到哪个分支
- javascript - React nodemailer net.isIP 不是一个函数
- zend-framework - 了解zend中的网格布局
- apache-nifi - 如何在 apache nifi 中连接 putHQL