@@ -2550,20 +2550,6 @@ def test_accuracy_logaddexp(shape, dtype):
25502550
25512551 with flag_gems .use_gems ():
25522552 res_out = torch .logaddexp (x , y )
2553- @pytest .mark .fmod
2554- @pytest .mark .parametrize ("shape" , POINTWISE_SHAPES )
2555- @pytest .mark .parametrize ("dtype" , FLOAT_DTYPES )
2556- def test_accuracy_fmod (shape , dtype ):
2557- inp1 = torch .randn (shape , dtype = dtype , device = flag_gems .device )
2558- inp2 = torch .randn (shape , dtype = dtype , device = flag_gems .device )
2559- # Avoid division by zero
2560- inp2 = torch .where (inp2 == 0 , torch .ones_like (inp2 ), inp2 )
2561- ref_inp1 = to_reference (inp1 , True )
2562- ref_inp2 = to_reference (inp2 , True )
2563-
2564- ref_out = torch .fmod (ref_inp1 , ref_inp2 )
2565- with flag_gems .use_gems ():
2566- res_out = torch .fmod (inp1 , inp2 )
25672553
25682554 gems_assert_close (res_out , ref_out , dtype )
25692555
@@ -2605,6 +2591,24 @@ def test_accuracy_copysign(shape, dtype):
26052591 gems_assert_close (res_out , ref_out , dtype )
26062592
26072593
2594+ @pytest .mark .fmod
2595+ @pytest .mark .parametrize ("shape" , POINTWISE_SHAPES )
2596+ @pytest .mark .parametrize ("dtype" , FLOAT_DTYPES )
2597+ def test_accuracy_fmod (shape , dtype ):
2598+ inp1 = torch .randn (shape , dtype = dtype , device = flag_gems .device )
2599+ inp2 = torch .randn (shape , dtype = dtype , device = flag_gems .device )
2600+ # Avoid division by zero
2601+ inp2 = torch .where (inp2 == 0 , torch .ones_like (inp2 ), inp2 )
2602+ ref_inp1 = to_reference (inp1 , True )
2603+ ref_inp2 = to_reference (inp2 , True )
2604+
2605+ ref_out = torch .fmod (ref_inp1 , ref_inp2 )
2606+ with flag_gems .use_gems ():
2607+ res_out = torch .fmod (inp1 , inp2 )
2608+
2609+ gems_assert_close (res_out , ref_out , dtype )
2610+
2611+
26082612@pytest .mark .fmod
26092613@pytest .mark .parametrize ("shape" , POINTWISE_SHAPES )
26102614@pytest .mark .parametrize ("scalar" , SCALARS )
0 commit comments