Question about `training` parameter in model and layer calls

In the Functional API, for something like:

inputs = tf.keras.Input(shape=(32,))
t = tf.keras.layers.Dense(10)(inputs)
t = tf.keras.layers.Dropout(0.5)(t)
outputs = tf.keras.layers.Dense(1)(t)
model = tf.keras.Model(inputs, outputs)

I think in this case, the Dropout layer is active during model.fit but is not active during ‘model.predict/evaluate’?

If so, how is training = True passed into the Dropout layer’s call method during model.fit() but training = False passed when calling model.predict() or model.evaluate()? I assume that model's train_step has invokes the call method (something like self(input, training = True)) but I’m not sure how training gets passed into the call method for each layer.

Hi @Lu_Bin_Liu, The training flag is automatically handled by the Keras. During training the training flag is set to True , and during inference the training flag is set to False by default. you don’t need to mention explicitly. Thank you!