(strategy)
| 1165 | |
| 1166 | |
| 1167 | def _assert_replica_context(strategy): |
| 1168 | replica_context = distribution_strategy_context.get_replica_context() |
| 1169 | if not replica_context: |
| 1170 | raise RuntimeError( |
| 1171 | "Replica-local variables may only be assigned in a replica context.") |
| 1172 | if replica_context.strategy is not strategy: |
| 1173 | raise RuntimeError( |
| 1174 | "Replica-local variables may only be assigned in a replica context.") |
| 1175 | |
| 1176 | |
| 1177 | class SyncOnReadVariable(DistributedVariable): |