-
Notifications
You must be signed in to change notification settings - Fork 146
Closed
Labels
Description
If you call atleast_Nd(x, 1) it will treat 1 as an array. This was very surprising, if someone wants to call it on multiple arrays they can use a loop.
pytensor/pytensor/tensor/basic.py
Lines 4348 to 4370 in 601658d
| def atleast_Nd( | |
| *arys: np.ndarray | TensorVariable, n: int = 1, left: bool = True | |
| ) -> TensorVariable: | |
| """Convert inputs to arrays with at least `n` dimensions.""" | |
| res = [] | |
| for ary in arys: | |
| ary = as_tensor(ary) | |
| if ary.ndim >= n: | |
| result = ary | |
| else: | |
| result = ( | |
| shape_padleft(ary, n - ary.ndim) | |
| if left | |
| else shape_padright(ary, n - ary.ndim) | |
| ) | |
| res.append(result) | |
| if len(res) == 1: | |
| return res[0] | |
| else: | |
| return res |