Skip to content

Commit

Permalink
Speed up _extract_graph_with_inputs_outputs
Browse files Browse the repository at this point in the history
ghstack-source-id: e8b93cf6f7278eea2e0d04c4c627c2190f508ae0
Pull Request resolved: #125937
  • Loading branch information
aorenste committed May 10, 2024
1 parent 946b96f commit c4391f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion torch/_functorch/partitioners.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def _extract_graph_with_inputs_outputs(joint_graph, inputs, outputs):
env[node] = new_node

for node in joint_graph.nodes:
if node in inputs:
if node in env:
# Node must be one of our inputs. (Any member of env which wasn't an
# input to start must have been created by this loop and won't be in
# joint_graph.nodes).
continue
elif node.op == "placeholder":
env[node] = InvalidNode
Expand Down

0 comments on commit c4391f3

Please sign in to comment.