(strategy)
| 569 | |
| 570 | |
| 571 | def _assert_strategy(strategy): |
| 572 | if not distribution_strategy_context.has_strategy(): |
| 573 | raise RuntimeError( |
| 574 | 'Need to be inside "with strategy.scope()" for %s' % |
| 575 | (strategy,)) |
| 576 | current_strategy = distribution_strategy_context.get_strategy() |
| 577 | if current_strategy is not strategy: |
| 578 | raise RuntimeError( |
| 579 | "Mixing different tf.distribute.Strategy objects: %s is not %s" % |
| 580 | (current_strategy, strategy)) |
| 581 | |
| 582 | |
| 583 | @contextlib.contextmanager |
no outgoing calls
no test coverage detected