- no global_variables_initializer()
这是由于版本问题,在前面加上compat.v1即可,如下:
init = tf.compat.v1.global_variables_initializer()
2.Session的graph为empty
将前面添加变量的代码移至session里面,如下:
3.哈哈哈这不是20吗?
4.sess = tf.compat.v1.Session()
print(sess.run©)
报错:AttributeError: Tensor.graph is meaningless when eager execution is enabled.
解决:找到了更好的方法
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
然后,确实变成了0,我错了吴大大
5.要求四行,只写了三行
原来是忘了加在一起了