Skip to content

Commit 2caf19b

Browse files
Fix smooth quant param grid (#3756)
### Changes Fix from #3754
1 parent 9462fc1 commit 2caf19b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/nncf/quantization/algorithms/hyperparameter_tuner/param_grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _get_smooth_quant_param_grid() -> ParamGrid:
8787
alpha_values = [0.15, 0.25, 0.5, 0.75, 0.95]
8888
return {
8989
"advanced_parameters:smooth_quant_alphas": [
90-
AdvancedSmoothQuantParameters(matmul=alpha_v) for alpha_v in itertools.product(alpha_values)
90+
AdvancedSmoothQuantParameters(matmul=alpha_v) for (alpha_v,) in itertools.product(alpha_values)
9191
]
9292
}
9393

tests/common/hyperparameter_tuner/test_hyperparameter_tuner.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from nncf.quantization.algorithms.hyperparameter_tuner.algorithm import apply_combination
2020
from nncf.quantization.algorithms.hyperparameter_tuner.algorithm import create_combinations
2121
from nncf.quantization.algorithms.hyperparameter_tuner.algorithm import find_best_combination
22+
from nncf.quantization.algorithms.hyperparameter_tuner.param_grid import _get_smooth_quant_param_grid
2223

2324
CombinationKey = tuple[int, ...]
2425
Combination = dict[str, Any]
@@ -471,3 +472,14 @@ def score_f(key):
471472
assert number_considered_combinations == score_function_call_count, (
472473
f"Expected {number_considered_combinations} combinations to be considered, but got {score_function_call_count}."
473474
)
475+
476+
477+
def test_smooth_quant_param_grid():
478+
matmul_expected_alpha_values = [0.15, 0.25, 0.5, 0.75, 0.95]
479+
480+
param_grid = _get_smooth_quant_param_grid()
481+
smooth_quant_alphas = param_grid["advanced_parameters:smooth_quant_alphas"]
482+
483+
for i, matmul_alpha in enumerate(matmul_expected_alpha_values):
484+
smooth_quant_alphas[i].matmul == matmul_alpha
485+
smooth_quant_alphas[i].convolution == -1

0 commit comments

Comments
 (0)