|
32 | 32 | from pytensor.scalar.basic import ScalarOp, as_scalar |
33 | 33 | from pytensor.tensor import blas, tensor |
34 | 34 | from pytensor.tensor.elemwise import Elemwise |
35 | | -from pytensor.tensor.sort import ArgSortOp, SortOp |
36 | 35 |
|
37 | 36 |
|
38 | 37 | if TYPE_CHECKING: |
@@ -356,70 +355,6 @@ def test_create_numba_signature(v, expected, force_scalar): |
356 | 355 | assert res == expected |
357 | 356 |
|
358 | 357 |
|
359 | | -@pytest.mark.parametrize( |
360 | | - "x", |
361 | | - [ |
362 | | - [], # Empty list |
363 | | - [3, 2, 1], # Simple list |
364 | | - np.random.randint(0, 10, (3, 2, 3, 4, 4)), # Multi-dimensional array |
365 | | - ], |
366 | | -) |
367 | | -@pytest.mark.parametrize("axis", [0, -1, None]) |
368 | | -@pytest.mark.parametrize( |
369 | | - ("kind", "exc"), |
370 | | - [ |
371 | | - ["quicksort", None], |
372 | | - ["mergesort", UserWarning], |
373 | | - ["heapsort", UserWarning], |
374 | | - ["stable", UserWarning], |
375 | | - ], |
376 | | -) |
377 | | -def test_Sort(x, axis, kind, exc): |
378 | | - if axis: |
379 | | - g = SortOp(kind)(pt.as_tensor_variable(x), axis) |
380 | | - else: |
381 | | - g = SortOp(kind)(pt.as_tensor_variable(x)) |
382 | | - |
383 | | - cm = contextlib.suppress() if not exc else pytest.warns(exc) |
384 | | - |
385 | | - with cm: |
386 | | - compare_numba_and_py([], [g], []) |
387 | | - |
388 | | - |
389 | | -@pytest.mark.parametrize( |
390 | | - "x", |
391 | | - [ |
392 | | - [], # Empty list |
393 | | - [3, 2, 1], # Simple list |
394 | | - None, # Multi-dimensional array (see below) |
395 | | - ], |
396 | | -) |
397 | | -@pytest.mark.parametrize("axis", [0, -1, None]) |
398 | | -@pytest.mark.parametrize( |
399 | | - ("kind", "exc"), |
400 | | - [ |
401 | | - ["quicksort", None], |
402 | | - ["heapsort", None], |
403 | | - ["stable", UserWarning], |
404 | | - ], |
405 | | -) |
406 | | -def test_ArgSort(x, axis, kind, exc): |
407 | | - if x is None: |
408 | | - x = np.arange(5 * 5 * 5 * 5) |
409 | | - np.random.shuffle(x) |
410 | | - x = np.reshape(x, (5, 5, 5, 5)) |
411 | | - |
412 | | - if axis: |
413 | | - g = ArgSortOp(kind)(pt.as_tensor_variable(x), axis) |
414 | | - else: |
415 | | - g = ArgSortOp(kind)(pt.as_tensor_variable(x)) |
416 | | - |
417 | | - cm = contextlib.suppress() if not exc else pytest.warns(exc) |
418 | | - |
419 | | - with cm: |
420 | | - compare_numba_and_py([], [g], []) |
421 | | - |
422 | | - |
423 | 358 | def test_ViewOp(): |
424 | 359 | v = pt.vector() |
425 | 360 | v_test_value = np.arange(4, dtype=config.floatX) |
|
0 commit comments