Bob Zheng
Bob Zheng

Reputation: 895

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

When I try:

normalization_layer = layers.Rescaling(1./255)

error message:

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

How to fix it?

Upvotes: 3

Views: 9824

Answers (2)

Adi Shumely
Adi Shumely

Reputation: 397

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

Upvotes: 5

Bob Zheng
Bob Zheng

Reputation: 895

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
)

Upvotes: 0

Related Questions