Skip to content

Commit 643209c

Browse files
committed
Add error message in Numba implementation of SpecifyShape
1 parent 3458a69 commit 643209c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pytensor/link/numba/dispatch/basic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,11 +564,11 @@ def numba_funcify_SpecifyShape(op, node, **kwargs):
564564
shape_input_names = ["shape_" + str(i) for i in range(len(shape_inputs))]
565565

566566
func_conditions = [
567-
f"assert x.shape[{i}] == {shape_input_names}"
568-
for i, (shape_input, shape_input_names) in enumerate(
567+
f"assert x.shape[{i}] == {eval_dim_name}, f'SpecifyShape: dim {{{i}}} of input has shape {{x.shape[{i}]}}, expected {{{eval_dim_name}.item()}}.'"
568+
for i, (node_dim_input, eval_dim_name) in enumerate(
569569
zip(shape_inputs, shape_input_names)
570570
)
571-
if shape_input is not NoneConst
571+
if node_dim_input is not NoneConst
572572
]
573573

574574
func = dedent(

0 commit comments

Comments
 (0)