【问题标题】:keras - adding LeakyrRelu on seqauential model throws errorkeras - 在顺序模型上添加 LeakyrRelu 会引发错误
【发布时间】:2020-07-17 13:20:46
【问题描述】:

second_fashion_model.add(LeakyReLU(alpha=0.05))

抛出错误:

添加的图层必须是图层类的实例。成立:

【问题讨论】:

    标签: keras activation-function relu


    【解决方案1】:

    确保:

    1. 您使用的是最新版本的 Keras
    2. 您正在使用 Keras 层而不是 Tensorflow.keras 层(每 here)

    例子:

    from keras.layers import LeakyReLU
    model = Sequential()
    model.add(Dense(90))
    model.add(LeakyReLU(alpha=0.03))
    

    【讨论】:

      猜你喜欢
      • 2017-06-13
      • 1970-01-01
      • 1970-01-01
      • 2021-11-20
      • 1970-01-01
      • 2019-01-01
      • 1970-01-01
      • 2022-01-09
      • 2021-03-29
      相关资源
      最近更新 更多