AttributeError: module 'tensorflow' has no attribute'name_scope' 'placeholder'等问题的解决

问题原因在于在tf2下调用了tf1的API,而tf2中是没有placeholder的。

解决方法:

使用:

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

替换:

import tensorflow as tf

原文地址:https://www.cnblogs.com/lzqstudy/p/15117097.html