File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -603,6 +603,10 @@ def squeeze(x, axis=None):
603
603
except np .AxisError :
604
604
raise np .AxisError (axis , ndim = _x .ndim )
605
605
606
+ if not axis :
607
+ # Nothing to do
608
+ return _x
609
+
606
610
return _x .dimshuffle ([i for i in range (_x .ndim ) if i not in axis ])
607
611
608
612
Original file line number Diff line number Diff line change @@ -868,7 +868,8 @@ def shape_padleft(t, n_ones=1):
868
868
869
869
"""
870
870
_t = at .as_tensor_variable (t )
871
-
871
+ if n_ones == 0 :
872
+ return _t
872
873
pattern = ["x" ] * n_ones + list (range (_t .type .ndim ))
873
874
return _t .dimshuffle (pattern )
874
875
@@ -884,7 +885,8 @@ def shape_padright(t, n_ones=1):
884
885
885
886
"""
886
887
_t = at .as_tensor_variable (t )
887
-
888
+ if n_ones == 0 :
889
+ return _t
888
890
pattern = list (range (_t .type .ndim )) + ["x" ] * n_ones
889
891
return _t .dimshuffle (pattern )
890
892
You can’t perform that action at this time.
0 commit comments