@@ -2404,22 +2404,22 @@ def test_local_blockwise_advanced_inc_subtensor(set_instead_of_inc):
2404
2404
np .testing .assert_allclose (fn (test_x , test_y ), expected_out )
2405
2405
2406
2406
2407
- @pytest .mark .parametrize ("fstop, lstop, lstep" , [(None , 9 , 1 ), (- 1 , - 1 , - 1 )])
2408
- def test_slice_canonicalize (fstop , lstop , lstep ):
2407
+ def test_slice_canonicalize ():
2409
2408
x = tensor (shape = (3 , 5 , None , 9 ))
2410
- y = x [0 :fstop , 0 :5 , 0 :7 , 0 :lstop :lstep ]
2409
+ # Test case 1
2410
+ y = x [0 :None , 0 :5 , 0 :7 , 0 :9 :1 ]
2411
2411
f = pytensor .function ([x ], y )
2412
- test_y = f .maker .fgraph .toposort ()
2412
+ test_y = f .maker .fgraph .outputs [ 0 ]. owner . inputs [ 0 ]
2413
2413
2414
- y1 = x [None :None :None , None :None :None , None :7 : None , None : None :None ]
2414
+ expected_y = x [None :None :None , None :None :None , None :7 :None ]
2415
2415
2416
- if fstop == - 1 and lstop == - 1 and lstep == - 1 :
2417
- y1 = x [None :- 1 :None , None :None :None , None :7 :None , None :- 1 :- 1 ]
2416
+ assert equal_computations ([test_y ], [expected_y ])
2418
2417
2418
+ # Test case 2
2419
+ y1 = x [0 :- 1 , 0 :5 , 0 :7 , 0 :- 1 :- 1 ]
2419
2420
f1 = pytensor .function ([x ], y1 )
2420
- expected_y = f1 .maker .fgraph .toposort ()
2421
+ test_y1 = f1 .maker .fgraph .outputs [ 0 ]. owner . inputs [ 0 ]
2421
2422
2422
- assert all (
2423
- equal_computations ([x1 ], [y1 ])
2424
- for x1 , y1 in zip (test_y [0 ].inputs , expected_y [0 ].inputs )
2425
- )
2423
+ expected_y1 = x [None :- 1 :None , None :None :None , None :7 :None , None :- 1 :- 1 ]
2424
+
2425
+ assert equal_computations ([test_y1 ], [expected_y1 ])
0 commit comments