module 'tensorflow' has no attribute 'placeholder'

tensorflow2.0提示错误:

module 'tensorflow' has no attribute 'placeholder'

解决办法:
不要使用:

import tensorflow as tf

替换为:

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

tensorflow的新变化,后续查到具体的文档,再补充。

原文地址:https://stackoverflow.com/questions/37383812/tensorflow-module-object-has-no-attribute-placeholder

你可能感兴趣的:(机器学习)