<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/orbit/utils/common.py#L22-L44) |

Creates a [`tf.Variable`](https://www.tensorflow.org/api_docs/python/tf/Variable) suitable for use as a global step counter.

    orbit.utils.create_global_step() -> tf.Variable

Creating and managing a global step variable may be necessary for
`AbstractTrainer` subclasses that perform multiple parameter updates per
`Controller` "step", or use different optimizers on different steps.

In these cases, an `optimizer.iterations` property generally can't be used
directly, since it would correspond to parameter updates instead of iterations
in the `Controller`'s training loop. Such use cases should simply call
`step.assign_add(1)` at the end of each step.

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A non-trainable scalar [`tf.Variable`](https://www.tensorflow.org/api_docs/python/tf/Variable) of dtype [`tf.int64`](https://www.tensorflow.org/api_docs/python/tf#int64), with only the first replica's value retained when synchronizing across replicas in a distributed setting. ||

<br />