From fa1f8f6bff6cc28c6ebce322c1b006c9b7035437 Mon Sep 17 00:00:00 2001 From: dlyakhov Date: Tue, 15 Oct 2024 13:47:02 +0200 Subject: [PATCH] Comments --- nncf/experimental/torch/fx/constant_folding.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nncf/experimental/torch/fx/constant_folding.py b/nncf/experimental/torch/fx/constant_folding.py index 053462fead5..23aa651f599 100644 --- a/nncf/experimental/torch/fx/constant_folding.py +++ b/nncf/experimental/torch/fx/constant_folding.py @@ -240,15 +240,17 @@ def insert_placerholder_values(self, env: Dict[torch.fx.Node, Any]) -> None: def constant_fold( gm: torch.fx.GraphModule, - constraint_fn: Optional[Callable[[torch.fx.Node], bool]] = None, ) -> None: + """ + Calcualtes constant subgraphs values and replaces them with a constan node inplace. + + :param gm: Given graph model. + """ with torch.utils._python_dispatch._disable_current_modes(): cf = ConstantFolder(gm, skip_constructors=True) cf.run() for node, constant in cf.node_replacements.items(): - if constraint_fn is not None and not constraint_fn(node): - continue replace_node_with_constant(gm, node, constant) erased_params = []