tf.keras.backend.set_learning_phase

View source on GitHub

Sets the learning phase to a fixed value. (deprecated)

The backend learning phase affects any code that calls backend.learningphase() In particular, all Keras built-in layers use the learning phase as the default for the training arg to <a href="../../../tf/keras/layers/Layer#call">Layer.call_.

User-written layers and models can achieve the same behavior with code that looks like:

def call(self, inputs, training=None):
  if training is None:
    training = backend.learning_phase()
Arguments
value Learning phase value, either 0 or 1 (integers). 0 = test, 1 = train
Raises
ValueError if value is neither 0 nor 1.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/backend/set_learning_phase