@@ -465,7 +465,7 @@ def test_ok_elem_2(self):
465
465
def test_ok_row (self ):
466
466
n = self .shared (np .arange (6 , dtype = self .dtype ).reshape ((2 , 3 )))
467
467
t = n [1 ]
468
- assert not any (n .type .broadcastable )
468
+ assert not any (s == 1 for s in n .type .shape )
469
469
assert isinstance (t .owner .op , Subtensor )
470
470
tval = self .eval_output_and_check (t )
471
471
assert tval .shape == (3 ,)
@@ -475,7 +475,7 @@ def test_ok_col(self):
475
475
n = self .shared (np .arange (6 , dtype = self .dtype ).reshape ((2 , 3 )))
476
476
t = n [:, 0 ]
477
477
assert isinstance (t .owner .op , Subtensor )
478
- assert not any (n .type .broadcastable )
478
+ assert not any (s == 1 for s in n .type .shape )
479
479
tval = self .eval_output_and_check (t )
480
480
assert tval .shape == (2 ,)
481
481
assert np .all (tval == [0 , 3 ])
@@ -1773,15 +1773,17 @@ def test_index_into_vec_w_vec(self):
1773
1773
def test_index_into_vec_w_matrix (self ):
1774
1774
a = self .v [self .ix2 ]
1775
1775
assert a .dtype == self .v .dtype , (a .dtype , self .v .dtype )
1776
- assert a .broadcastable == self .ix2 .broadcastable , (
1777
- a .broadcastable ,
1778
- self .ix2 .broadcastable ,
1776
+ assert a .type .ndim == self .ix2 .type .ndim
1777
+ assert all (
1778
+ s1 == s2
1779
+ for s1 , s2 in zip (a .type .shape , self .ix2 .type .shape )
1780
+ if s1 == 1 or s2 == 1
1779
1781
)
1780
1782
1781
1783
def test_index_into_mat_w_row (self ):
1782
1784
a = self .m [self .ixr ]
1783
1785
assert a .dtype == self .m .dtype , (a .dtype , self .m .dtype )
1784
- assert a .broadcastable == (True , False , False )
1786
+ assert a .type . shape == (1 , None , None )
1785
1787
1786
1788
def test_index_w_int_and_vec (self ):
1787
1789
# like test_ok_list, but with a single index on the first one
@@ -2447,7 +2449,7 @@ def test_AdvancedSubtensor_bool(self):
2447
2449
)
2448
2450
2449
2451
abs_res = n [~ isinf (n )]
2450
- assert abs_res .broadcastable == (False ,)
2452
+ assert abs_res .type . shape == (None ,)
2451
2453
2452
2454
2453
2455
@config .change_flags (compute_test_value = "raise" )
@@ -2468,9 +2470,7 @@ def idx_as_tensor(x):
2468
2470
def bcast_shape_tuple (x ):
2469
2471
if not hasattr (x , "shape" ):
2470
2472
return x
2471
- return tuple (
2472
- s if not bcast else 1 for s , bcast in zip (tuple (x .shape ), x .broadcastable )
2473
- )
2473
+ return tuple (s if ss != 1 else 1 for s , ss in zip (tuple (x .shape ), x .type .shape ))
2474
2474
2475
2475
2476
2476
test_idx = np .ix_ (np .array ([True , True ]), np .array ([True ]), np .array ([True , True ]))
0 commit comments