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