AttributeError: module ‘tensorflow‘ has no attribute ‘python‘

问题:AttributeError: module ‘tensorflow’ has no attribute ‘python’
AttributeError: module ‘tensorflow‘ has no attribute ‘python‘_第1张图片
在这里插入图片描述
出错代码行:

import tensorflow as tf
model_lstm_attention = tf.python.keras.Model(inputs=inp, outputs=x)

解决方案

from tensorflow.python import keras as tpk
model_lstm_attention = tpk.Model(inputs=inp, outputs=x)

你可能感兴趣的:(bug,深度学习,tensorflow)