torchfoo.module.make_ddp#
- torchfoo.module.make_ddp(m, find_unused_parameters=False)[source]#
Wrap a module with DDP and convert BatchNorm to SyncBatchNorm.
Returns the module unchanged if not in distributed mode.
Warning
SyncBatchNorm only works with GPU modules. On CPU, BatchNorm layers will not be converted and a warning is emitted.
- Parameters:
- Returns:
The DDP-wrapped module, or the original module if not distributed.