MCPcopy Create free account
hub / github.com/OpenGVLab/DragGAN / ddp_sync

Function ddp_sync

draggan/stylegan2/torch_utils/misc.py:167–173  ·  view source on GitHub ↗
(module, sync)

Source from the content-addressed store, hash-verified

165
166@contextlib.contextmanager
167def 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.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected