Home > database >  I get error: module 'tensorflow.keras.layers' has no attribute 'Normalization'
I get error: module 'tensorflow.keras.layers' has no attribute 'Normalization'

Time:10-08

I use

layers.Normalization()

in Keras, in keras.Sequential When I try to run it, I get the following error:

module 'tensorflow.keras.layers' has no attribute 'Normalization'

I've seen the command layers.Normalization() being used in many codes, so I don't know what's wrong. Did something change?

CodePudding user response:

Check the version of TensorFlow you have:

import tensorflow as tf
print(tf.__version__)

tf.keras.layers.Normalization is an attribute in TensorFlow v2.6.0, so might not work on earlier versions: https://www.tensorflow.org/api_docs/python/tf/keras/layers/Normalization

If you have an earlier version, you can upgrade using

pip install --upgrade tensorflow
  • Related