我收到此错误 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)
在
next_layer = Dense(128, activation='relu', kernel_initializer=regularizers.l2(0.01))(next_layer)
行中,将参数 kernel_initializer
更改为 kernel_regularizer
,因为 l2
是 tf.keras.Regularizer
。