类型错误:L2.__call__() 获得意外的关键字参数“dtype”Keras

问题描述 投票:0回答:1

我收到此错误 TypeError: L2.call() 得到了意外的关键字参数“dtype”

当我创建图层时

next_layer=密集(128,激活='relu',kernel_initializer=regularizers.l2(0.01))(next_layer)

使用谷歌colab

有什么帮助吗? 提前谢谢

next_layer=GlobalAveragePooling2D()(output)
next_layer=Dense(1024, activation='relu')(next_layer)
next_layer=Dense(512, activation='relu')(next_layer)
next_layer = Dense(128, activation='relu', kernel_initializer=regularizers.l2(0.01))(next_layer)
next_layer=Dense(2048, activation='relu')(next_layer)
keras typeerror dtype
1个回答
0
投票

next_layer = Dense(128, activation='relu', kernel_initializer=regularizers.l2(0.01))(next_layer)
行中,将参数
kernel_initializer
更改为
kernel_regularizer
,因为
l2
tf.keras.Regularizer

© www.soinside.com 2019 - 2024. All rights reserved.