Skip to content

Commit 5316cfc

Browse files
Use static shape information about inputs
1 parent f22edc0 commit 5316cfc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sunode/wrappers/as_pytensor.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ def read_dict(vals, name=None):
4545
if isinstance(vals, tuple):
4646
tensor, dim_names = vals
4747
else:
48-
try:
49-
tensor, dim_names = vals, pt.as_tensor_variable(vals, dtype="float64").shape.eval()
50-
except MissingInputError as e:
48+
tensor, dim_names = vals, pt.as_tensor_variable(vals, dtype="float64").type.shape
49+
if any(d is None for d in dim_names):
5150
raise ValueError(
52-
'Shapes of tensors need to be statically '
53-
'known or given explicitly.') from e
51+
'Shapes of tensors need to be statically known or given explicitly.'
52+
)
5453
if isinstance(dim_names, (str, int)):
5554
dim_names = (dim_names,)
5655
tensor = pt.as_tensor_variable(tensor, dtype="float64")

0 commit comments

Comments
 (0)