@@ -400,7 +400,6 @@ def test_err_invalid(self):
400
400
with pytest .raises (IndexError ):
401
401
n .__getitem__ (0 )
402
402
403
- @config .change_flags (compute_test_value = "off" )
404
403
def test_err_bounds (self ):
405
404
n = self .shared (np .ones (3 , dtype = self .dtype ))
406
405
t = n [7 ]
@@ -481,7 +480,6 @@ def test_ok_strided(self):
481
480
assert tval .shape == (2 ,)
482
481
assert (tval == [0.0 , 2.0 ]).all ()
483
482
484
- @config .change_flags (compute_test_value = "off" )
485
483
def test_err_bounds0 (self ):
486
484
n = self .shared (np .ones ((2 , 3 ), dtype = self .dtype ) * 5 )
487
485
for idx in [(0 , 4 ), (0 , - 4 )]:
@@ -497,7 +495,6 @@ def test_err_bounds0(self):
497
495
finally :
498
496
_logger .setLevel (oldlevel )
499
497
500
- @config .change_flags (compute_test_value = "off" )
501
498
def test_err_bounds1 (self ):
502
499
n = self .shared (np .ones ((2 , 3 ), dtype = self .dtype ) * 5 )
503
500
t = n [4 :5 , 3 ]
@@ -719,71 +716,70 @@ def numpy_inc_subtensor(x, idx, a):
719
716
inc_subtensor (n4 [test_array > 2 , ..., 0 , 1 ], 1 ).eval (),
720
717
)
721
718
722
- with config .change_flags (compute_test_value = "off" ):
723
- # the boolean mask should have the correct shape
724
- # - too large, padded with True
725
- mask = np .array ([True , False , True ])
726
- with pytest .raises (IndexError ):
727
- test_array [mask ].eval ()
728
- with pytest .raises (IndexError ):
729
- test_array [mask , ...].eval ()
730
- with pytest .raises (IndexError ):
731
- inc_subtensor (test_array [mask ], 1 ).eval ()
732
- with pytest .raises (IndexError ):
733
- inc_subtensor (test_array [mask , ...], 1 ).eval ()
734
- mask = np .array ([[True , False , False , True ], [False , True , False , True ]])
735
- with pytest .raises (IndexError ):
736
- test_array [mask ].eval ()
737
- with pytest .raises (IndexError ):
738
- inc_subtensor (test_array [mask ], 1 ).eval ()
739
- # - too large, padded with False (this works in NumPy < 0.13.0)
740
- mask = np .array ([True , False , False ])
741
- with pytest .raises (IndexError ):
742
- test_array [mask ].eval ()
743
- with pytest .raises (IndexError ):
744
- test_array [mask , ...].eval ()
745
- with pytest .raises (IndexError ):
746
- inc_subtensor (test_array [mask ], 1 ).eval ()
747
- with pytest .raises (IndexError ):
748
- inc_subtensor (test_array [mask , ...], 1 ).eval ()
749
- mask = np .array ([[True , False , False , False ], [False , True , False , False ]])
750
- with pytest .raises (IndexError ):
751
- test_array [mask ].eval ()
752
- with pytest .raises (IndexError ):
753
- inc_subtensor (test_array [mask ], 1 ).eval ()
754
- # - mask too small (this works in NumPy < 0.13.0)
755
- mask = np .array ([True ])
756
- with pytest .raises (IndexError ):
757
- test_array [mask ].eval ()
758
- with pytest .raises (IndexError ):
759
- test_array [mask , ...].eval ()
760
- with pytest .raises (IndexError ):
761
- inc_subtensor (test_array [mask ], 1 ).eval ()
762
- with pytest .raises (IndexError ):
763
- inc_subtensor (test_array [mask , ...], 1 ).eval ()
764
- mask = np .array ([[True ], [True ]])
765
- with pytest .raises (IndexError ):
766
- test_array [mask ].eval ()
767
- with pytest .raises (IndexError ):
768
- inc_subtensor (test_array [mask ], 1 ).eval ()
769
- # - too many dimensions
770
- mask = np .array ([[[True , False , False ], [False , True , False ]]])
771
- with pytest .raises (IndexError ):
772
- test_array .__getitem__ (mask )
773
- with pytest .raises (IndexError ):
774
- test_array .__getitem__ (mask )
775
-
776
- # special cases: Python bools and bools nested in Python arrays are not supported
777
- with pytest .raises (TypeError ):
778
- test_array .__getitem__ ((True ,))
779
- with pytest .raises (TypeError ):
780
- test_array .__getitem__ ((False ,))
781
- with pytest .raises (TypeError ):
782
- test_array .__getitem__ ((True , False ))
783
- with pytest .raises (TypeError ):
784
- test_array .__getitem__ (([0 , 1 ], [0 , False ]))
785
- with pytest .raises (TypeError ):
786
- test_array .__getitem__ (([0 , 1 ], [0 , pytensor .shared (True )]))
719
+ # the boolean mask should have the correct shape
720
+ # - too large, padded with True
721
+ mask = np .array ([True , False , True ])
722
+ with pytest .raises (IndexError ):
723
+ test_array [mask ].eval ()
724
+ with pytest .raises (IndexError ):
725
+ test_array [mask , ...].eval ()
726
+ with pytest .raises (IndexError ):
727
+ inc_subtensor (test_array [mask ], 1 ).eval ()
728
+ with pytest .raises (IndexError ):
729
+ inc_subtensor (test_array [mask , ...], 1 ).eval ()
730
+ mask = np .array ([[True , False , False , True ], [False , True , False , True ]])
731
+ with pytest .raises (IndexError ):
732
+ test_array [mask ].eval ()
733
+ with pytest .raises (IndexError ):
734
+ inc_subtensor (test_array [mask ], 1 ).eval ()
735
+ # - too large, padded with False (this works in NumPy < 0.13.0)
736
+ mask = np .array ([True , False , False ])
737
+ with pytest .raises (IndexError ):
738
+ test_array [mask ].eval ()
739
+ with pytest .raises (IndexError ):
740
+ test_array [mask , ...].eval ()
741
+ with pytest .raises (IndexError ):
742
+ inc_subtensor (test_array [mask ], 1 ).eval ()
743
+ with pytest .raises (IndexError ):
744
+ inc_subtensor (test_array [mask , ...], 1 ).eval ()
745
+ mask = np .array ([[True , False , False , False ], [False , True , False , False ]])
746
+ with pytest .raises (IndexError ):
747
+ test_array [mask ].eval ()
748
+ with pytest .raises (IndexError ):
749
+ inc_subtensor (test_array [mask ], 1 ).eval ()
750
+ # - mask too small (this works in NumPy < 0.13.0)
751
+ mask = np .array ([True ])
752
+ with pytest .raises (IndexError ):
753
+ test_array [mask ].eval ()
754
+ with pytest .raises (IndexError ):
755
+ test_array [mask , ...].eval ()
756
+ with pytest .raises (IndexError ):
757
+ inc_subtensor (test_array [mask ], 1 ).eval ()
758
+ with pytest .raises (IndexError ):
759
+ inc_subtensor (test_array [mask , ...], 1 ).eval ()
760
+ mask = np .array ([[True ], [True ]])
761
+ with pytest .raises (IndexError ):
762
+ test_array [mask ].eval ()
763
+ with pytest .raises (IndexError ):
764
+ inc_subtensor (test_array [mask ], 1 ).eval ()
765
+ # - too many dimensions
766
+ mask = np .array ([[[True , False , False ], [False , True , False ]]])
767
+ with pytest .raises (IndexError ):
768
+ test_array .__getitem__ (mask )
769
+ with pytest .raises (IndexError ):
770
+ test_array .__getitem__ (mask )
771
+
772
+ # special cases: Python bools and bools nested in Python arrays are not supported
773
+ with pytest .raises (TypeError ):
774
+ test_array .__getitem__ ((True ,))
775
+ with pytest .raises (TypeError ):
776
+ test_array .__getitem__ ((False ,))
777
+ with pytest .raises (TypeError ):
778
+ test_array .__getitem__ ((True , False ))
779
+ with pytest .raises (TypeError ):
780
+ test_array .__getitem__ (([0 , 1 ], [0 , False ]))
781
+ with pytest .raises (TypeError ):
782
+ test_array .__getitem__ (([0 , 1 ], [0 , pytensor .shared (True )]))
787
783
788
784
def test_grad_1d (self ):
789
785
subi = 0
@@ -2492,13 +2488,12 @@ def test_AdvancedSubtensor(self):
2492
2488
bivec .tag .test_value = bivec_val
2493
2489
2494
2490
# Make sure it doesn't complain about test values
2495
- with config .change_flags (compute_test_value = "raise" ):
2496
- self ._compile_and_check (
2497
- [admat , aivec ],
2498
- [admat [1 :3 , aivec ]],
2499
- [admat_val , aivec_val ],
2500
- AdvancedSubtensor ,
2501
- )
2491
+ self ._compile_and_check (
2492
+ [admat , aivec ],
2493
+ [admat [1 :3 , aivec ]],
2494
+ [admat_val , aivec_val ],
2495
+ AdvancedSubtensor ,
2496
+ )
2502
2497
2503
2498
def test_AdvancedSubtensor_bool (self ):
2504
2499
n = dmatrix ()
0 commit comments