Skip to content

Commit 827d72d

Browse files
committed
support on_unused_input for string parameter names in eval
1 parent 1d40471 commit 827d72d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytensor/graph/basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,15 +616,15 @@ def eval(
616616
"""
617617
from pytensor.compile.function import function
618618

619-
on_unused_input = kwargs.get("on_unused_input", None)
619+
ignore_unused_input = kwargs.get("on_unused_input", None) in ("ignore", "warn")
620620

621621
def convert_string_keys_to_variables(inputs_to_values) -> dict["Variable", Any]:
622622
new_input_to_values = {}
623623
for key, value in inputs_to_values.items():
624624
if isinstance(key, str):
625625
matching_vars = get_var_by_name([self], key)
626626
if not matching_vars:
627-
if on_unused_input in ["raise", None]:
627+
if not ignore_unused_input:
628628
raise ValueError(f"{key} not found in graph")
629629
elif len(matching_vars) > 1:
630630
raise ValueError(f"Found multiple variables with name {key}")

0 commit comments

Comments
 (0)