AttributeError:模块“tensorflow.keras.layers”没有属性“Rescaling”

Bob*_*eng 3 keras tensorflow

当我尝试时:

normalization_layer = layers.Rescaling(1./255)
Run Code Online (Sandbox Code Playgroud)

错误信息:

AttributeError: module 'tensorflow.keras.layers' has no attribute 'Rescaling'
Run Code Online (Sandbox Code Playgroud)

如何修复它?

Adi*_*ely 5

我在 v2.5.0 中遇到了同样的错误

tf.keras.layers.experimental.preprocessing.Rescaling()
Run Code Online (Sandbox Code Playgroud)

我想这是使用该层的“旧”方法