解决ModuleNotFoundError: No module named ‘tensorflow.contrib‘

解决ModuleNotFoundError: No module named ‘tensorflow.contrib’

记录出错修改
tensorflow1.x中的代码:

from tensorflow.contrib.layers.python import layers as tf_layers
tf_layers.batch_norm()
tf_layers.layer_norm()

在tensorflow2.x中修改为

tf.keras.layers.BatchNormalization()
tf.keras.layers.LayerNormalization()

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