Skip to content

Commit

Permalink
Update test_fused_bias_leakyrelu.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jayggh authored Dec 12, 2022
1 parent 780e3a1 commit 7bb7049
Showing 1 changed file with 7 additions and 27 deletions.
34 changes: 7 additions & 27 deletions tests/test_ops/test_fused_bias_leakyrelu.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,12 @@ def test_gradient(self, device):
self.input_tensor,
delta=1e-4,
pt_atol=1e-3)
elif IS_NPU_AVAILABLE:
gradcheck(
FusedBiasLeakyReLU(2).npu(),
self.input_tensor,
delta=1e-4,
pt_atol=1e-3)
else:
if IS_CUDA_AVAILABLE:
gradcheck(
FusedBiasLeakyReLU(2).cuda(),
self.input_tensor,
eps=1e-4,
atol=1e-3)
elif IS_NPU_AVAILABLE:
gradcheck(
FusedBiasLeakyReLU(2).npu(),
self.input_tensor,
eps=1e-4,
atol=1e-3)
gradcheck(
FusedBiasLeakyReLU(2).to(device),
self.input_tensor,
eps=1e-4,
atol=1e-3)

@pytest.mark.parametrize('device', [
pytest.param(
Expand All @@ -80,15 +67,8 @@ def test_gradient(self, device):
def test_gradgradient(self, device):

from mmcv.ops import FusedBiasLeakyReLU
if IS_CUDA_AVAILABLE:
gradcheck(
FusedBiasLeakyReLU(2).cuda(),
self.input_tensor,
eps=1e-4,
atol=1e-3)
elif IS_NPU_AVAILABLE:
gradcheck(
FusedBiasLeakyReLU(2).npu(),
gradcheck(
FusedBiasLeakyReLU(2).to(device),
self.input_tensor,
eps=1e-4,
atol=1e-3)

0 comments on commit 7bb7049

Please sign in to comment.