Skip to content

Commit 466402c

Browse files
factnntengqm
andauthored
Apply suggestions from code review
Co-authored-by: Qiming Teng <tengqm@outlook.com> Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com>
1 parent 622deaf commit 466402c

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

benchmark/test_fmod_perf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def fmod_scalar_input_fn(shape, cur_dtype, device):
1717
yield inp1, 0.5
1818

1919

20-
@pytest.mark.fmod
20+
@pytest.mark.fmod_tensor
2121
def test_fmod():
2222
bench = GenericBenchmark(
2323
input_fn=fmod_input_fn,
@@ -28,7 +28,7 @@ def test_fmod():
2828
bench.run()
2929

3030

31-
@pytest.mark.fmod
31+
@pytest.mark.fmod_scalar
3232
def test_fmod_scalar():
3333
bench = GenericBenchmark(
3434
input_fn=fmod_scalar_input_fn,
@@ -39,7 +39,7 @@ def test_fmod_scalar():
3939
bench.run()
4040

4141

42-
@pytest.mark.fmod
42+
@pytest.mark.fmod_tensor_
4343
def test_fmod_inplace():
4444
bench = GenericBenchmark(
4545
input_fn=fmod_input_fn,
@@ -50,7 +50,7 @@ def test_fmod_inplace():
5050
bench.run()
5151

5252

53-
@pytest.mark.fmod
53+
@pytest.mark.fmod_scalar_
5454
def test_fmod_inplace_scalar():
5555
bench = GenericBenchmark(
5656
input_fn=fmod_scalar_input_fn,

tests/test_fmod.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
)
1313

1414

15-
@pytest.mark.fmod
15+
@pytest.mark.fmod_tensor
1616
@pytest.mark.parametrize("shape", POINTWISE_SHAPES)
1717
@pytest.mark.parametrize("dtype", FLOAT_DTYPES)
18-
def test_accuracy_fmod(shape, dtype):
18+
def test_fmod_tensor(shape, dtype):
1919
inp1 = torch.randn(shape, dtype=dtype, device=flag_gems.device)
2020
inp2 = torch.randn(shape, dtype=dtype, device=flag_gems.device)
2121
inp2 = torch.where(inp2 == 0, torch.ones_like(inp2), inp2)
@@ -27,11 +27,11 @@ def test_accuracy_fmod(shape, dtype):
2727
gems_assert_close(res_out, ref_out, dtype)
2828

2929

30-
@pytest.mark.fmod
30+
@pytest.mark.fmod_scalar
3131
@pytest.mark.parametrize("shape", POINTWISE_SHAPES)
3232
@pytest.mark.parametrize("scalar", SCALARS)
3333
@pytest.mark.parametrize("dtype", FLOAT_DTYPES)
34-
def test_accuracy_fmod_tensor_scalar(shape, scalar, dtype):
34+
def test_fmod_scalar(shape, scalar, dtype):
3535
inp1 = torch.randn(shape, dtype=dtype, device=flag_gems.device)
3636
inp2 = scalar if scalar != 0 else 1.0
3737
ref_inp1 = to_reference(inp1, True)
@@ -42,11 +42,10 @@ def test_accuracy_fmod_tensor_scalar(shape, scalar, dtype):
4242
gems_assert_close(res_out, ref_out, dtype, atol=atol)
4343

4444

45-
@pytest.mark.inplace
46-
@pytest.mark.fmod_
45+
@pytest.mark.fmod_tensor_
4746
@pytest.mark.parametrize("shape", POINTWISE_SHAPES)
4847
@pytest.mark.parametrize("dtype", FLOAT_DTYPES)
49-
def test_accuracy_fmod_(shape, dtype):
48+
def test_fmod_tensor_inplace(shape, dtype):
5049
inp1 = torch.randn(shape, dtype=dtype, device=flag_gems.device)
5150
inp2 = torch.randn(shape, dtype=dtype, device=flag_gems.device)
5251
inp2 = torch.where(inp2 == 0, torch.ones_like(inp2), inp2)
@@ -58,12 +57,11 @@ def test_accuracy_fmod_(shape, dtype):
5857
gems_assert_close(res_out, ref_out, dtype)
5958

6059

61-
@pytest.mark.inplace
62-
@pytest.mark.fmod_
60+
@pytest.mark.fmod_scalar_
6361
@pytest.mark.parametrize("shape", POINTWISE_SHAPES)
6462
@pytest.mark.parametrize("scalar", SCALARS)
6563
@pytest.mark.parametrize("dtype", FLOAT_DTYPES)
66-
def test_accuracy_fmod_tensor_scalar_(shape, scalar, dtype):
64+
def testy_fmod_scalar_inplace(shape, scalar, dtype):
6765
inp1 = torch.randn(shape, dtype=dtype, device=flag_gems.device)
6866
inp2 = scalar if scalar != 0 else 1.0
6967
ref_inp1 = to_reference(inp1.clone(), True)

0 commit comments

Comments
 (0)