构建神经网络时报错
AttributeError: module ‘tensorflow’ has no attribute ‘get_default_graph’
可能原因:
- tensorflow和keras版本不统一,可参看应该安装的对应版本https://docs.floydhub.com/guides/environments/。
以我电脑为例,可导入tensorflow和keras后查看版本。tensorflow版本为2.0,对应的keras应为2.3.1
import tensorflow as tf
print(tf.__version__)
import keras
print(keras.__version__