【问题标题】:AttributeError: module 'tensorflow.keras.layers' has no attribute 'Rescaling'AttributeError:模块“tensorflow.keras.layers”没有属性“重新缩放”
【发布时间】:2022-01-18 11:58:55
【问题描述】:

当我尝试时:

normalization_layer = layers.Rescaling(1./255)

错误信息:

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

如何解决?

【问题讨论】:

  • 您可能使用了错误的 tf 版本。
  • 你使用的是哪个 tensorflow 版本?

标签: tensorflow keras


【解决方案1】:

是的,我使用了错误版本的 tf.在 tf v2.70 中重新缩放,我使用的是 v2.60。

将输入值重新缩放到新范围的预处理层。 继承自:层、模块

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-30
    • 2020-05-16
    • 2017-12-19
    • 2021-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多