MCPcopy Create free account
hub / github.com/apple/ml-vivid / ddp_sync

Function ddp_sync

torch_utils/misc.py:177–183  ·  view source on GitHub ↗
(module, sync)

Source from the content-addressed store, hash-verified

175
176@contextlib.contextmanager
177def 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.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected