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.