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

Viewed 9209

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?

2 Answers

One reason can be that you are using the tensorflow version older then the required to use that layer. There are two ways to get around this problem.

  1. Upgrade tensorflow as discussed above.
  2. Or you can add the layer as follows:
tf.keras.layers.experimental.preprocessing.Normalization

Regards

Related