Tensorflow报错:InvalidArgumentError: You must feed a value for placeholder tensor 'input_y' with dtype

此错误神奇之处是每次第一次运行不会报错,第二次、第三次第四次。。。。就都报错了。关掉重启,又不报错了,运行完再运行一次立马报错!搞笑!

折磨了我半天,终于被我给解决了!

问题解决来源于这边博客:https://blog.csdn.net/m0_37870649/article/details/79428960

我的解决方法:在fit模型的代码前面加入一行代码:tf.reset_default_graph()

如下图:

我原本是猜想自定义TextCNN模型的代码中出了问题,但其实这个错误和dtype没有关系。目前个人理解为是在自定义的TextCNN模型代码中有一段生成graph的代码。每第一次运行时不会出错了,同时生成了graph,再次、再再次都运行出错,原因或许是发生了冲突。那我重置一下就行了,于是便有了tf.reset_default_greph()成功解决问题的情况了。

自定义TextCNN代码部分内容:

For details, please refer https://stackoverflow.com/questions/35114376/error-when-computing-summaries-in-tensorflow

Tensorflow报错:InvalidArgumentError: You must feed a value for placeholder tensor 'input_y' with dtype

原文地址:https://www.cnblogs.com/Christina-Notebook/p/10283485.html

时间: 2024-07-30 14:03:25

Tensorflow报错:InvalidArgumentError: You must feed a value for placeholder tensor 'input_y' with dtype的相关文章

InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder_1' with dtype float and shape [?,10]

在莫烦Python教程的"Dropout 解决 overfitting"一节中,出现错误如下: InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder_1' with dtype float and shape [?,10] runfile('E:/python/kerasTest/tfDropoutTest9.py', wdir='E:/python/kerasTest') C:\

import tensorflow 报错: tf.estimator package not installed.

import tensorflow 报错: tf.estimator package not installed. 解决方案1: 安装 pip install tensorflow-estimator==1.10.12 解决方案2: downgrade pandas from 0.23.4 to 0.23.0 upgrade matplotlib to 3.0.0 原文地址:https://www.cnblogs.com/sddai/p/10538807.html

pandas 报错:【sys:1: DtypeWarning: Columns (15) have mixed types. Specify dtype option on import or set low_memory=False.】

错误原因 报错提示:“sys:1: DtypeWarning: Columns (15) have mixed types. Specify dtype option on import or set low_memory=False.” 错误:类型混淆 解决 import pandas as pd pd = pd.read_csv(Your_path, low_memory=False) 关键点 low_memory low_memory : boolean, default True # 分

Windows下安装Tensorflow报错 “DLL load failed:找不到指定的模块"

Windows下安装完tensorflow后,在cmd下运行python后import tensorflow出现如下错误: Traceback (most recent call last): File "D:\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper return importlib.import_

TensorFlow报错:failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE

版本: tensorflow-gpu 原因: 在创建session时没有使用我想让它用的gpu 解决方案: 1. 在python程序中: import os os.environ["CUDA_VISIBLE_DEVICES"] = "0" 2. 运行时: CUDA_VISIBLE_DEVICES=0 python **.py 3. 直接在环境变量中 export export CUDA_VISIBLE_DEVICES='0' python **.py

PyCharm导入tensorflow包报错的问题

[注]PyCharm导入tensorflow包报错的问题 若是你也遇到这个问题,说明你也没有理解tensorflow到底在哪里. 当安装了anaconda3.6后,在PyCharm中设置interpreter,这个解释器决定了你在PyCharm环境中写的代码采用什么方式去执行. 若是你的设置是anaconda下的python.exe.就会发现在PyCharm中写入import tensorflow as tf 时,就会报错,提示没有tensorflow模块,这是因为anaconda文件下的pyt

报错解决——Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

在导入tensorflow后,进行运算时,出现了报错Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 解决方法:在最顶行写入以下代码即可 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' 参考资料:Advanced Vector Extensions import os os.environ["TF_CPP_M

tensorflow读取jpg格式图片报错 ValueError: Only know how to handle extensions: ['png']; with Pillow installed matplotlib can handle more images

当运行mpimg.imread("img.jpg")时,spyder 出现如下错误: ValueError: Only know how to handle extensions: ['png']; with Pillow installed matplotlib can handle more images 解决办法就是  安装pillow即可 我是在anaconde里安装的很简单,执行如下步骤即可: tensorflow读取jpg格式图片报错 ValueError: Only kn

Tensorflow运行程序报错 FailedPreconditionError

1 FailedPreconditionError错误现象 在运行tensorflow时出现报错,报错语句如下: FailedPreconditionError (see above for traceback): Attempting to use uninitialized value Variable [[Node: Variable/read = _MklIdentity[T=DT_FLOAT, _kernel="MklOp", _device="/job:local