# tf.keras.backend.learning_phase

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/backend/learning_phase) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/keras/backend.py#L269-L302) |

Returns the learning phase flag.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.keras.backend.learning_phase`](https://www.tensorflow.org/api_docs/python/tf/keras/backend/learning_phase)

<br />

    tf.keras.backend.learning_phase()

The learning phase flag is a bool tensor (0 = test, 1 = train)
to be passed as input to any Keras function
that uses a different behavior at train time and test time.

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Learning phase (scalar integer tensor or Python integer). ||

<br />