|
31 | 31 | from pytensor.scalar.basic import ScalarOp, as_scalar |
32 | 32 | from pytensor.tensor import blas, tensor |
33 | 33 | from pytensor.tensor.elemwise import Elemwise |
34 | | -from pytensor.tensor.sort import ArgSortOp, SortOp |
35 | 34 |
|
36 | 35 |
|
37 | 36 | if TYPE_CHECKING: |
@@ -331,70 +330,6 @@ def test_create_numba_signature(v, expected, force_scalar): |
331 | 330 | assert res == expected |
332 | 331 |
|
333 | 332 |
|
334 | | -@pytest.mark.parametrize( |
335 | | - "x", |
336 | | - [ |
337 | | - [], # Empty list |
338 | | - [3, 2, 1], # Simple list |
339 | | - np.random.randint(0, 10, (3, 2, 3, 4, 4)), # Multi-dimensional array |
340 | | - ], |
341 | | -) |
342 | | -@pytest.mark.parametrize("axis", [0, -1, None]) |
343 | | -@pytest.mark.parametrize( |
344 | | - ("kind", "exc"), |
345 | | - [ |
346 | | - ["quicksort", None], |
347 | | - ["mergesort", UserWarning], |
348 | | - ["heapsort", UserWarning], |
349 | | - ["stable", UserWarning], |
350 | | - ], |
351 | | -) |
352 | | -def test_Sort(x, axis, kind, exc): |
353 | | - if axis: |
354 | | - g = SortOp(kind)(pt.as_tensor_variable(x), axis) |
355 | | - else: |
356 | | - g = SortOp(kind)(pt.as_tensor_variable(x)) |
357 | | - |
358 | | - cm = contextlib.suppress() if not exc else pytest.warns(exc) |
359 | | - |
360 | | - with cm: |
361 | | - compare_numba_and_py([], [g], []) |
362 | | - |
363 | | - |
364 | | -@pytest.mark.parametrize( |
365 | | - "x", |
366 | | - [ |
367 | | - [], # Empty list |
368 | | - [3, 2, 1], # Simple list |
369 | | - None, # Multi-dimensional array (see below) |
370 | | - ], |
371 | | -) |
372 | | -@pytest.mark.parametrize("axis", [0, -1, None]) |
373 | | -@pytest.mark.parametrize( |
374 | | - ("kind", "exc"), |
375 | | - [ |
376 | | - ["quicksort", None], |
377 | | - ["heapsort", None], |
378 | | - ["stable", UserWarning], |
379 | | - ], |
380 | | -) |
381 | | -def test_ArgSort(x, axis, kind, exc): |
382 | | - if x is None: |
383 | | - x = np.arange(5 * 5 * 5 * 5) |
384 | | - np.random.shuffle(x) |
385 | | - x = np.reshape(x, (5, 5, 5, 5)) |
386 | | - |
387 | | - if axis: |
388 | | - g = ArgSortOp(kind)(pt.as_tensor_variable(x), axis) |
389 | | - else: |
390 | | - g = ArgSortOp(kind)(pt.as_tensor_variable(x)) |
391 | | - |
392 | | - cm = contextlib.suppress() if not exc else pytest.warns(exc) |
393 | | - |
394 | | - with cm: |
395 | | - compare_numba_and_py([], [g], []) |
396 | | - |
397 | | - |
398 | 333 | def test_ViewOp(): |
399 | 334 | v = pt.vector() |
400 | 335 | v_test_value = np.arange(4, dtype=config.floatX) |
|
0 commit comments