mmcv/tests/test_ops/test_masked_conv2d.py
Zaida Zhou 45fa3e44a2
Add pyupgrade pre-commit hook (#1937)
* add pyupgrade

* add options for pyupgrade

* minor refinement
2022-05-18 11:47:14 +08:00

16 lines
488 B
Python

# Copyright (c) OpenMMLab. All rights reserved.
import torch
class TestMaskedConv2d:
def test_masked_conv2d(self):
if not torch.cuda.is_available():
return
from mmcv.ops import MaskedConv2d
input = torch.randn(1, 3, 16, 16, requires_grad=True, device='cuda')
mask = torch.randn(1, 16, 16, requires_grad=True, device='cuda')
conv = MaskedConv2d(3, 3, 3).cuda()
output = conv(input, mask)
assert output is not None