MCPcopy Create free account
hub / github.com/pytorch/executorch / remove_body_nodes

Method remove_body_nodes

backends/mlx/pattern_utils.py:348–356  ·  view source on GitHub ↗

Remove body nodes from the graph (in reverse order for safety). Call after replacing head with fused op.

(self, graph: Graph)

Source from the content-addressed store, hash-verified

346 return None
347
348 def remove_body_nodes(self, graph: Graph) -> None:
349 """
350 Remove body nodes from the graph (in reverse order for safety).
351
352 Call after replacing head with fused op.
353 """
354 for node in reversed(self.body):
355 if has_no_users(node):
356 graph.erase_node(node)
357
358 def all_nodes(self) -> List[Node]:
359 """Return all nodes in the pattern (head + body)."""

Callers 2

callMethod · 0.80

Calls 2

has_no_usersFunction · 0.85
erase_nodeMethod · 0.80

Tested by 1