gpt4 book ai didi

python - TensorFlow : NotFoundError: Resource AnonymousIterator Error

转载 作者:太空宇宙 更新时间:2023-11-03 20:29:40 25 4
gpt4 key购买 nike

我正在尝试复制在时间序列中使用 RNN 的示例,如发布的 https://www.tensorflow.org/beta/tutorials/text/time_series#multi-step_model

但是,我收到以下错误消息:

 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 doc ,

它指出:

Creates an Iterator for enumerating the elements of this dataset.

The returned iterator implements the Python iterator protocol and therefore can only be used in eager mode.

因此您需要在脚本开头使用tf.enable_eager_execution()

关于python - TensorFlow : NotFoundError: Resource AnonymousIterator Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57589683/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com