attributeError:module “tensorflow“ has no attribute [placeholder]

attributeError:module “tensorflow“ has no attribute [placeholder]_第1张图片

 报错原因:tensorflow 2.0版本去掉了placeholder,而tensorflow 1.*版本才有。

解决:

import tensorflow.compat.v1 as tf

tf.disable_v2_behavior()

替换

import tensorflow as tf

你可能感兴趣的:(tensorflow,人工智能,python)