|
9 | 9 | from tests.third_party.cupy import testing
|
10 | 10 |
|
11 | 11 |
|
12 |
| -@pytest.mark.usefixtures("allow_fall_back_on_numpy") |
13 | 12 | @testing.gpu
|
14 | 13 | class TestArrayReduction(unittest.TestCase):
|
15 | 14 | @testing.for_all_dtypes()
|
@@ -149,70 +148,70 @@ def test_min_nan_imag(self, xp, dtype):
|
149 | 148 | @testing.numpy_cupy_allclose()
|
150 | 149 | def test_ptp_all(self, xp, dtype):
|
151 | 150 | a = testing.shaped_random((2, 3), xp, dtype)
|
152 |
| - return a.ptp() |
| 151 | + return xp.ptp(a) |
153 | 152 |
|
154 | 153 | @testing.with_requires("numpy>=1.15")
|
155 | 154 | @testing.for_all_dtypes(no_bool=True)
|
156 | 155 | @testing.numpy_cupy_allclose()
|
157 | 156 | def test_ptp_all_keepdims(self, xp, dtype):
|
158 | 157 | a = testing.shaped_random((2, 3), xp, dtype)
|
159 |
| - return a.ptp(keepdims=True) |
| 158 | + return xp.ptp(a, keepdims=True) |
160 | 159 |
|
161 | 160 | @testing.for_all_dtypes(no_bool=True)
|
162 | 161 | @testing.numpy_cupy_allclose()
|
163 | 162 | def test_ptp_axis_large(self, xp, dtype):
|
164 | 163 | a = testing.shaped_random((3, 1000), xp, dtype)
|
165 |
| - return a.ptp(axis=0) |
| 164 | + return xp.ptp(a, axis=0) |
166 | 165 |
|
167 | 166 | @testing.for_all_dtypes(no_bool=True)
|
168 | 167 | @testing.numpy_cupy_allclose()
|
169 | 168 | def test_ptp_axis0(self, xp, dtype):
|
170 | 169 | a = testing.shaped_random((2, 3, 4), xp, dtype)
|
171 |
| - return a.ptp(axis=0) |
| 170 | + return xp.ptp(a, axis=0) |
172 | 171 |
|
173 | 172 | @testing.for_all_dtypes(no_bool=True)
|
174 | 173 | @testing.numpy_cupy_allclose()
|
175 | 174 | def test_ptp_axis1(self, xp, dtype):
|
176 | 175 | a = testing.shaped_random((2, 3, 4), xp, dtype)
|
177 |
| - return a.ptp(axis=1) |
| 176 | + return xp.ptp(a, axis=1) |
178 | 177 |
|
179 | 178 | @testing.for_all_dtypes(no_bool=True)
|
180 | 179 | @testing.numpy_cupy_allclose()
|
181 | 180 | def test_ptp_axis2(self, xp, dtype):
|
182 | 181 | a = testing.shaped_random((2, 3, 4), xp, dtype)
|
183 |
| - return a.ptp(axis=2) |
| 182 | + return xp.ptp(a, axis=2) |
184 | 183 |
|
185 | 184 | @testing.with_requires("numpy>=1.15")
|
186 | 185 | @testing.for_all_dtypes(no_bool=True)
|
187 | 186 | @testing.numpy_cupy_allclose()
|
188 | 187 | def test_ptp_multiple_axes(self, xp, dtype):
|
189 | 188 | a = testing.shaped_random((2, 3, 4), xp, dtype)
|
190 |
| - return a.ptp(axis=(1, 2)) |
| 189 | + return xp.ptp(a, axis=(1, 2)) |
191 | 190 |
|
192 | 191 | @testing.with_requires("numpy>=1.15")
|
193 | 192 | @testing.for_all_dtypes(no_bool=True)
|
194 | 193 | @testing.numpy_cupy_allclose()
|
195 | 194 | def test_ptp_multiple_axes_keepdims(self, xp, dtype):
|
196 | 195 | a = testing.shaped_random((2, 3, 4), xp, dtype)
|
197 |
| - return a.ptp(axis=(1, 2), keepdims=True) |
| 196 | + return xp.ptp(a, axis=(1, 2), keepdims=True) |
198 | 197 |
|
199 | 198 | @testing.for_float_dtypes()
|
200 | 199 | @testing.numpy_cupy_allclose()
|
201 | 200 | def test_ptp_nan(self, xp, dtype):
|
202 | 201 | a = xp.array([float("nan"), 1, -1], dtype)
|
203 |
| - return a.ptp() |
| 202 | + return xp.ptp(a) |
204 | 203 |
|
205 | 204 | @testing.for_complex_dtypes()
|
206 | 205 | @testing.numpy_cupy_allclose()
|
207 | 206 | def test_ptp_nan_real(self, xp, dtype):
|
208 | 207 | a = xp.array([float("nan"), 1, -1], dtype)
|
209 |
| - return a.ptp() |
| 208 | + return xp.ptp(a) |
210 | 209 |
|
211 | 210 | @testing.for_complex_dtypes()
|
212 | 211 | @testing.numpy_cupy_allclose()
|
213 | 212 | def test_ptp_nan_imag(self, xp, dtype):
|
214 | 213 | a = xp.array([float("nan") * 1.0j, 1.0j, -1.0j], dtype)
|
215 |
| - return a.ptp() |
| 214 | + return xp.ptp(a) |
216 | 215 |
|
217 | 216 |
|
218 | 217 | # This class compares CUB results against NumPy's
|
|
0 commit comments