# tf.train.get_or_create_global_step

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/training/training_util.py#L147-L162) |

Returns and create (if necessary) the global step tensor.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.train.get_or_create_global_step`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/train/get_or_create_global_step)

<br />

    tf.train.get_or_create_global_step(
        graph=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `graph` | The graph in which to create the global step tensor. If missing, use default graph. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The global step tensor. ||

<br />