File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
third_party/cupy/math_tests Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -1316,6 +1316,7 @@ def test_float_remainder_magnitude(dtype):
1316
1316
assert_equal (result , expected )
1317
1317
1318
1318
1319
+ @pytest .mark .usefixtures ("suppress_divide_numpy_warnings" )
1319
1320
@pytest .mark .usefixtures ("suppress_invalid_numpy_warnings" )
1320
1321
@pytest .mark .parametrize ("func" , ["remainder" , "fmod" ])
1321
1322
@pytest .mark .parametrize ("dtype" , get_float_dtypes (no_float16 = False ))
Original file line number Diff line number Diff line change @@ -127,14 +127,16 @@ def test_unary(self, xp):
127
127
if self .name in ("reciprocal" ) and xp is numpy :
128
128
# In NumPy, for integer arguments with absolute value larger than 1 the result is always zero.
129
129
# We need to convert the input data type to float then compare the output with DPNP.
130
- if arg1 .dtype .char in "bB" : # int8
131
- arg1 = xp .asarray (arg1 , dtype = numpy .float16 )
132
- elif arg1 .dtype .char in "hH" : # int16
133
- arg1 = xp .asarray (arg1 , dtype = numpy .float32 )
134
- elif arg1 .dtype .char in "iIlL" : # int32, int64
135
- np_dtype = (
136
- numpy .float64 if has_support_aspect64 () else numpy .float32
137
- )
130
+ if numpy .issubdtype (arg1 .dtype , numpy .integer ):
131
+ if arg1 .dtype .char in "bB" : # int8
132
+ np_dtype = numpy .float16
133
+ elif arg1 .dtype .char in "hH" : # int16
134
+ np_dtype = numpy .float32
135
+ else : # int32, int64
136
+ if has_support_aspect64 ():
137
+ np_dtype = numpy .float64
138
+ else :
139
+ np_dtype = numpy .float32
138
140
arg1 = xp .asarray (arg1 , dtype = np_dtype )
139
141
140
142
if self .name in {"angle" }:
You can’t perform that action at this time.
0 commit comments