mirror of
https://github.com/open-mmlab/mmocr.git
synced 2025-06-03 21:54:47 +08:00
17 lines
438 B
Python
17 lines
438 B
Python
# Copyright (c) OpenMMLab. All rights reserved.
|
|
import pytest
|
|
import torch
|
|
from mmcv.cnn.bricks import ConvModule
|
|
|
|
from mmocr.utils import revert_sync_batchnorm
|
|
|
|
|
|
def test_revert_sync_batchnorm():
|
|
conv = ConvModule(3, 8, 2, norm_cfg=dict(type='SyncBN'))
|
|
x = torch.randn(1, 3, 10, 10)
|
|
with pytest.raises(ValueError):
|
|
y = conv(x)
|
|
conv = revert_sync_batchnorm(conv)
|
|
y = conv(x)
|
|
assert y.shape == (1, 8, 9, 9)
|