Skip to content

Commit

Permalink
update transformations for impure nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
anzr299 committed Oct 31, 2024
1 parent 7e4b771 commit ee64fe4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nncf/experimental/torch/fx/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,5 +996,10 @@ def _merge_node_and_bias(model: torch.fx.GraphModule, is_target_node: Callable[[
# Remove nodes which are not connected to output. This removes dead nodes and dead subgraphs in the model graph.
nodes_connected_to_output = _get_connected_nodes(model.graph)
is_impure = lambda node: node in nodes_connected_to_output
model.graph.eliminate_dead_code(is_impure)

for node in reversed(model.graph.nodes):
if not is_impure(node) and len(node.users) == 0:
model.graph.erase_node(node)

model.graph.eliminate_dead_code()
model.recompile()

0 comments on commit ee64fe4

Please sign in to comment.