From c0420c8da5617f6d4b8b7cd23f4605b5847ef004 Mon Sep 17 00:00:00 2001 From: Nikita Malinin Date: Thu, 12 Dec 2024 15:07:47 +0100 Subject: [PATCH] WA for other backends --- .../algorithms/fast_bias_correction/algorithm.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nncf/quantization/algorithms/fast_bias_correction/algorithm.py b/nncf/quantization/algorithms/fast_bias_correction/algorithm.py index 5b791c790de..2c3dc75a4f6 100644 --- a/nncf/quantization/algorithms/fast_bias_correction/algorithm.py +++ b/nncf/quantization/algorithms/fast_bias_correction/algorithm.py @@ -163,7 +163,15 @@ def apply( output_fp = self._get_fp_outputs(statistic_points, out_node_name) - extracted_model = self._backend_entity.build_submodel(model, node, input_port_id, 0) + if hasattr(self._backend_entity, "build_submodel"): + extracted_model = self._backend_entity.build_submodel(model, node, input_port_id, 0) + else: + # In case of the matrix multiplication layers, this is crucial to know the correct input port. + input_id = (in_node_name, input_port_id) + # Outputs of the subgraphs for the FastBiasCorrection are the same across the backends. + output_id = (out_node_name, 0) + + extracted_model = self._extract_submodel(model_transformer, input_id, output_id) if extracted_model is None: nncf_logger.debug(f"Skipping node {node_name} because cant extract submodel") continue