小编Mri*_*tyu的帖子

Keras Sequential API 中的训练 = False

当使用 Keras Function API 时,我们可以training = False在调用预训练模型时传递参数,如教程所示。

如何在 Keras Sequential API 中实现相同的功能?

这是我尝试使用 Sequential API 复制的代码:

inputs = tf.keras.Input( shape = ( TARGET_SIZE[0], TARGET_SIZE[1], 3 ) )
base_model = Xception( include_top = False, pooling = 'avg' )
base_model.trainable = False
x = base_model( inputs, training = False ) 
x = Dense( 512, activation = 'relu' )( x )
x = Dense( 256, activation = 'relu' )( x )
x = Dense( 128, activation = 'relu' )( …
Run Code Online (Sandbox Code Playgroud)

machine-learning neural-network keras tensorflow

7
推荐指数
1
解决办法
3307
查看次数