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

posted @ 2021-08-09 08:54  lzq的小窝  阅读(772)  评论(0编辑  收藏  举报