1212BOOL_TYPES = [torch .bool ]
1313
1414
15- @pytest .mark .xor__
15+ @pytest .mark .xor
1616@pytest .mark .parametrize ("shape" , utils .POINTWISE_SHAPES )
1717@pytest .mark .parametrize ("dtype" , INT_DTYPES + BOOL_TYPES )
18- def test_xor__ (shape , dtype ):
18+ def test_xor (shape , dtype ):
1919 if dtype in BOOL_TYPES :
2020 inp1 = torch .randint (0 , 2 , size = shape , dtype = dtype , device = "cpu" ).to (
2121 flag_gems .device
@@ -40,34 +40,10 @@ def test_xor__(shape, dtype):
4040 utils .gems_assert_equal (res_out , ref_out )
4141
4242
43- @pytest .mark .xor__
43+ @pytest .mark .xor
4444@pytest .mark .parametrize ("shape" , utils .POINTWISE_SHAPES )
4545@pytest .mark .parametrize ("dtype" , INT_DTYPES + BOOL_TYPES )
46- def test_xor__inplace (shape , dtype ):
47- if dtype in BOOL_TYPES :
48- inp1 = torch .randint (0 , 2 , size = shape , dtype = dtype , device = flag_gems .device )
49- inp2 = torch .randint (0 , 2 , size = shape , dtype = dtype , device = flag_gems .device )
50- else :
51- inp1 = torch .randint (
52- low = - 0x7FFF , high = 0x7FFF , size = shape , dtype = dtype , device = "cpu"
53- ).to (flag_gems .device )
54- inp2 = torch .randint (
55- low = - 0x7FFF , high = 0x7FFF , size = shape , dtype = dtype , device = "cpu"
56- ).to (flag_gems .device )
57- ref_inp1 = utils .to_reference (inp1 .clone ())
58- ref_inp2 = utils .to_reference (inp2 )
59-
60- ref_out = ref_inp1 .__ixor__ (ref_inp2 )
61- with flag_gems .use_gems ():
62- res_out = inp1 .__ixor__ (inp2 )
63-
64- utils .gems_assert_equal (res_out , ref_out )
65-
66-
67- @pytest .mark .xor__
68- @pytest .mark .parametrize ("shape" , utils .POINTWISE_SHAPES )
69- @pytest .mark .parametrize ("dtype" , INT_DTYPES + BOOL_TYPES )
70- def test_xor__scalar (shape , dtype ):
46+ def test_xor_scalar (shape , dtype ):
7147 if dtype in BOOL_TYPES :
7248 inp1 = torch .randint (0 , 2 , size = shape , dtype = dtype , device = "cpu" ).to (
7349 flag_gems .device
@@ -85,24 +61,3 @@ def test_xor__scalar(shape, dtype):
8561 res_out = inp1 ^ inp2
8662
8763 utils .gems_assert_equal (res_out , ref_out )
88-
89-
90- @pytest .mark .xor__
91- @pytest .mark .parametrize ("shape" , utils .POINTWISE_SHAPES )
92- @pytest .mark .parametrize ("dtype" , INT_DTYPES + BOOL_TYPES )
93- def test_xor__scalar_inplace (shape , dtype ):
94- if dtype in BOOL_TYPES :
95- inp1 = torch .randint (0 , 2 , size = shape , dtype = dtype , device = flag_gems .device )
96- inp2 = bool (random .randint (0 , 2 ))
97- else :
98- inp1 = torch .randint (
99- low = - 0x7FFF , high = 0x7FFF , size = shape , dtype = dtype , device = "cpu"
100- ).to (flag_gems .device )
101- inp2 = 0x00FF
102- ref_inp1 = utils .to_reference (inp1 .clone ())
103-
104- ref_out = ref_inp1 .__ixor__ (inp2 )
105- with flag_gems .use_gems ():
106- res_out = inp1 .__ixor__ (inp2 )
107-
108- utils .gems_assert_equal (res_out , ref_out )
0 commit comments