(module, sync)
| 175 | |
| 176 | @contextlib.contextmanager |
| 177 | def ddp_sync(module, sync): |
| 178 | assert isinstance(module, torch.nn.Module) |
| 179 | if sync or not isinstance(module, torch.nn.parallel.DistributedDataParallel): |
| 180 | yield |
| 181 | else: |
| 182 | with module.no_sync(): |
| 183 | yield |
| 184 | |
| 185 | #---------------------------------------------------------------------------- |
| 186 | # Check DistributedDataParallel consistency across processes. |
nothing calls this directly
no outgoing calls
no test coverage detected