AttributeError: module 'tensorflow' has no attribute 'Session'
AttributeError: module 'tensorflow' has no attribute 'truncated_normal_initializer'
解决办法:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
这篇博客主要讨论了在使用TensorFlow时遇到的两个错误:'Session'属性缺失和'truncated_normal_initializer'未定义。为了解决这些问题,作者提供了导入tensorflow.compat.v1并禁用v2行为的解决方案。
AttributeError: module 'tensorflow' has no attribute 'Session'
AttributeError: module 'tensorflow' has no attribute 'truncated_normal_initializer'
解决办法:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
1万+
408
1274

被折叠的 条评论
为什么被折叠?
