(module, sync)
| 165 | |
| 166 | @contextlib.contextmanager |
| 167 | def ddp_sync(module, sync): |
| 168 | assert isinstance(module, torch.nn.Module) |
| 169 | if sync or not isinstance(module, torch.nn.parallel.DistributedDataParallel): |
| 170 | yield |
| 171 | else: |
| 172 | with module.no_sync(): |
| 173 | yield |
| 174 | |
| 175 | #---------------------------------------------------------------------------- |
| 176 | # Check DistributedDataParallel consistency across processes. |
nothing calls this directly
no outgoing calls
no test coverage detected