解决“Errors may have originated from an input operation. Input Source operations connected to node“

项目场景:

Tensorflow-gpu训练卷积时报出错误,虽然可以启动但无法训练
环境
pycharm
+tensorflow-gpu2.4.0
+python3.8
+cuda11.1

问题描述

报错
非常恼火!!!!!!!!!!!

Errors may have originated from an input operation.
Input Source operations connected to node Conv2D:

原因分析:

tensorflow2.X与tensorflow1.X不同

解决方案:

加上以下三行代码,解决问题

config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.compat.v1.Session(config=config)

你可能感兴趣的:(python,tensorflow)