TypeError: The value of a feed cannot be a tf.Tensor object. Acceptable feed values include Python scalars, strings, lists, numpy ndarrays, or TensorHandles.For reference, the tensor object was Tensor("ExpandDims:0", shape=(1, 28, 28, 1), dtype=float32) which was passed to the feed with key Tensor("input0:0", dtype=float32).

报错feed 不能是一个 tf.Tensor对象,无法执行,报错代码如下:

    if ckpt1 and ckpt1.model_checkpoint_path:
        save.restore(sess, ckpt1.model_checkpoint_path)
        for step in range(10):
            
            print(sess.run(y_pre,feed_dict={x1:img1}))

改为:

    if ckpt1 and ckpt1.model_checkpoint_path:
        save.restore(sess, ckpt1.model_checkpoint_path)
        for step in range(10):
            x_in = sess.run(img1)
            print(sess.run(y_pre,feed_dict={x1:x_in}))

程序正常。

GitHub 加速计划 / te / tensorflow
184.55 K
74.12 K
下载
一个面向所有人的开源机器学习框架
最近提交(Master分支:2 个月前 )
a49e66f2 PiperOrigin-RevId: 663726708 3 个月前
91dac11a This test overrides disabled_backends, dropping the default value in the process. PiperOrigin-RevId: 663711155 3 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐