Tensorflow 2.0 的 “placeholder” 问题

时间:2024-10-18 10:18:33

AttributeError: module ‘tensorflow’ has no attribute ‘placeholder’

解决方法:

import tensorflow.compat.v1 as tf

如果还出现报错,则需要关闭代码中关闭eager运算:

tf.disable_eager_execution()

2.0版本和1.0有很多不兼容,还需要大家去发现。
在这里插入图片描述

相关文章