Skip to content

Commit 247da0b

Browse files
committed
Check shape length matches dims in XTensorType
1 parent 10d0741 commit 247da0b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pytensor/xtensor/type.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def __init__(
4747
self.shape = (None,) * len(self.dims)
4848
else:
4949
self.shape = tuple(shape)
50+
if len(self.shape) != len(self.dims):
51+
raise ValueError(
52+
f"Shape {self.shape} must have the same length as dims {self.dims}"
53+
)
5054
self.ndim = len(self.dims)
5155
self.name = name
5256

0 commit comments

Comments
 (0)