MCPcopy Create free account
hub / github.com/Elsaam2y/DINet_optimized / patch_sync_batchnorm

Function patch_sync_batchnorm

sync_batchnorm/batchnorm.py:404–415  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

402
403@contextlib.contextmanager
404def patch_sync_batchnorm():
405 import torch.nn as nn
406
407 backup = nn.BatchNorm1d, nn.BatchNorm2d, nn.BatchNorm3d
408
409 nn.BatchNorm1d = SynchronizedBatchNorm1d
410 nn.BatchNorm2d = SynchronizedBatchNorm2d
411 nn.BatchNorm3d = SynchronizedBatchNorm3d
412
413 yield
414
415 nn.BatchNorm1d, nn.BatchNorm2d, nn.BatchNorm3d = backup
416
417
418def convert_model(module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected