tensorflow1.4文档提供了演示dataset" rel="nofollow noreferrer">Dataset.from_generator用法的代码。当我运行代码时,我得到一个InvalidArgumentError:0-th value returned by pyfunc_0 is int32, but expects int64
。在
我使用的是python3.6.1。代码如下:
def gen():
for i in itertools.count(1):
yield (i, [1] * i)
ds = tf.data.Dataset.from_generator(gen, (tf.int64, tf.int64),
(tf.TensorShape([]), tf.TensorShape([None])))
value = ds.make_one_shot_iterator().get_next()
with tf.Session() as sess:
sess.run(value) # (1, array([1]))
sess.run(value) # (2, array([1, 1]))
有什么想法吗?在
这是TensorFlow 1.4.0rc0在Windows上运行时的已知问题。这个错误已经在TensorFlow的夜间构建中得到了修复,cherry-picked被添加到TensorFlow 1.4.0的下一个候选版本中,即now available。在
同时,还有一些选择:
使用
pip install tf-nightly
安装夜间构建。请注意,这将包含一些1.4分支中不可用的特性,并且还没有像发行版分支那样受到测试。从源代码构建1.4分支。
等待发布1.4.0rc1候选版本。编辑:这个版本现在可以从PyPI使用
pip install tensorflow==1.4.0rc1
。相关问题 更多 >
编程相关推荐