# tfr.keras.strategy_utils.strategy_scope

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/keras/strategy_utils.py#L137-L156) |

Gets the strategy.scope() for training with strategy.

    tfr.keras.strategy_utils.strategy_scope(
        strategy: Optional[tf.distribute.Strategy]
    ) -> Any

#### Example usage:

    with strategy_scope(strategy):
      model = ...

<br />

<br />

<br />

| ## Args ||
|---|---|
| `strategy` | Distributed training strategy is used. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| ContextManager for the distributed training strategy. ||

<br />