From 3263f53ec8d8815668c28cd29f6aeed6d513d0f7 Mon Sep 17 00:00:00 2001 From: dlyakhov Date: Wed, 15 Nov 2023 12:12:13 +0100 Subject: [PATCH] Fix SQ axis for convs in OV backend --- nncf/quantization/algorithms/smooth_quant/openvino_backend.py | 2 +- tests/openvino/native/test_smooth_quant.py | 2 +- tests/shared/command.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nncf/quantization/algorithms/smooth_quant/openvino_backend.py b/nncf/quantization/algorithms/smooth_quant/openvino_backend.py index c75666f08ab..e3373cd32da 100644 --- a/nncf/quantization/algorithms/smooth_quant/openvino_backend.py +++ b/nncf/quantization/algorithms/smooth_quant/openvino_backend.py @@ -168,7 +168,7 @@ def get_activation_channel_axis(node: NNCFNode, port_id: int) -> int: @staticmethod def get_weight_channel_axis(node: NNCFNode) -> int: if node.metatype != OVMatMulMetatype: - return 1 if node.metatype.const_channel_axis is None else node.metatype.const_channel_axis[0] + return 1 weights_layout = get_linear_weights_layout_from_node(node) return weights_layout.index(OVLayoutElem.C_IN) diff --git a/tests/openvino/native/test_smooth_quant.py b/tests/openvino/native/test_smooth_quant.py index 0d4991e136d..187ed272862 100644 --- a/tests/openvino/native/test_smooth_quant.py +++ b/tests/openvino/native/test_smooth_quant.py @@ -111,7 +111,7 @@ def test_get_activation_channel_axis(self, node_metatype, layer_attributes, port OVLayoutElem.SPATIAL, OVLayoutElem.SPATIAL, ), - 0, + 1, ), ), ) diff --git a/tests/shared/command.py b/tests/shared/command.py index 99f94f5789e..68dea06a18c 100644 --- a/tests/shared/command.py +++ b/tests/shared/command.py @@ -22,11 +22,11 @@ class Command: def __init__(self, cmd: str, cwd: Path = None, env: Dict = None): - self.cmd = cmd + self.cmd = f"source /home/dlyakhov/Projects/nncf/tmp_env/bin/activate; {cmd}" self.process = None self.exec_time = -1 self.output = [] # store output here - self.kwargs = {} + self.kwargs = {"executable": "/bin/bash"} self.timeout = False self.cwd = cwd self.env = env if env is not None else os.environ.copy()