tfr.keras.strategy_utils.strategy_scope
Stay organized with collections
Save and categorize content based on your preferences.
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 = ...
Args |
strategy
|
Distributed training strategy is used.
|
Returns |
ContextManager for the distributed training strategy.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-08-18 UTC.
[null,null,["Last updated 2023-08-18 UTC."],[],[],null,["# tfr.keras.strategy_utils.strategy_scope\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/keras/strategy_utils.py#L137-L156) |\n\nGets the strategy.scope() for training with strategy. \n\n tfr.keras.strategy_utils.strategy_scope(\n strategy: Optional[tf.distribute.Strategy]\n ) -\u003e Any\n\n#### Example usage:\n\n with strategy_scope(strategy):\n model = ...\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|----------------------------------------|\n| `strategy` | Distributed training strategy is used. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| ContextManager for the distributed training strategy. ||\n\n\u003cbr /\u003e"]]