From 5af3834651900a8a3bc80a2b43d40fc153fbcf85 Mon Sep 17 00:00:00 2001 From: xinhe Date: Mon, 22 Jan 2024 15:47:27 +0800 Subject: [PATCH] fix ipex stats bug (#1555) Signed-off-by: xin3he --- neural_compressor/adaptor/pytorch.py | 3 ++- test/algorithm/test_smooth_quant.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/neural_compressor/adaptor/pytorch.py b/neural_compressor/adaptor/pytorch.py index 7acfd68d72f..eb62db6b40f 100644 --- a/neural_compressor/adaptor/pytorch.py +++ b/neural_compressor/adaptor/pytorch.py @@ -2599,7 +2599,8 @@ def get_non_quant_modules(self, model_kwargs): "": "Conv2d", "": "Conv3d", "": "ReLU", - "": "add", + "": "add", # for IPEX < 2.2 + "": "add", # for IPEX >= 2.2 "": "AdaptiveAvgPool2d", "Linear_Relu": "Linear", "": "Linear", diff --git a/test/algorithm/test_smooth_quant.py b/test/algorithm/test_smooth_quant.py index 89a6aff9aac..19ba6cb519f 100644 --- a/test/algorithm/test_smooth_quant.py +++ b/test/algorithm/test_smooth_quant.py @@ -41,6 +41,7 @@ def __init__(self): def forward(self, x): out = self.fc1(x) out = self.fc2(out) + out = out + out return out