()
| 402 | |
| 403 | @contextlib.contextmanager |
| 404 | def 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 | |
| 418 | def convert_model(module): |
nothing calls this directly
no outgoing calls
no test coverage detected