AttributeError: module 'tensorflow.keras.layers' has no attribute 'Rescaling'

Viewed 4636

When I try:

normalization_layer = layers.Rescaling(1./255)

error message:

AttributeError: module 'tensorflow.keras.layers' has no attribute 'Rescaling'

How to fix it?

2 Answers

I had the same error in v2.5.0

tf.keras.layers.experimental.preprocessing.Rescaling()

I guess this is the "old" way to use this layer

Yes, I used a wrong version of tf. Rescaling in tf v2.70, i used v2.60.

A preprocessing layer which rescales input values to a new range. Inherits From: Layer, Module

tf.keras.layers.Rescaling(
    scale, offset=0.0, **kwargs
)
Related