tf.keras.backend.set_learning_phase

TensorFlow 1 version 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()

value Learning phase value, either 0 or 1 (integers). 0 = test, 1 = train

ValueError if value is neither 0 nor 1.