Skip to content

Commit 3c26799

Browse files
committed
.avoid cast in hot loop
1 parent 60573b9 commit 3c26799

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pytensor/graph/basic.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,8 @@ def clone_node_and_cache(
915915
# Use a cached `Op` clone when available
916916
new_op: Op | None = cast(Optional["Op"], clone_d.get(node.op))
917917

918-
cloned_inputs: list[Variable] = [cast(Variable, clone_d[i]) for i in node.inputs]
919-
920918
new_node = node.clone_with_new_inputs(
921-
cloned_inputs,
919+
[clone_d[i] for i in node.inputs],
922920
# Only clone inner-graph `Op`s when there isn't a cached clone (and
923921
# when `clone_inner_graphs` is enabled)
924922
clone_inner_graph=clone_inner_graphs if new_op is None else False,

0 commit comments

Comments
 (0)