Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _get_smooth_quant_param_grid() -> ParamGrid:
alpha_values = [0.15, 0.25, 0.5, 0.75, 0.95]
return {
"advanced_parameters:smooth_quant_alphas": [
AdvancedSmoothQuantParameters(matmul=alpha_v) for alpha_v in itertools.product(alpha_values)
AdvancedSmoothQuantParameters(matmul=alpha_v) for (alpha_v,) in itertools.product(alpha_values)
]
}

Expand Down
12 changes: 12 additions & 0 deletions tests/common/hyperparameter_tuner/test_hyperparameter_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from nncf.quantization.algorithms.hyperparameter_tuner.algorithm import apply_combination
from nncf.quantization.algorithms.hyperparameter_tuner.algorithm import create_combinations
from nncf.quantization.algorithms.hyperparameter_tuner.algorithm import find_best_combination
from nncf.quantization.algorithms.hyperparameter_tuner.param_grid import _get_smooth_quant_param_grid

CombinationKey = tuple[int, ...]
Combination = dict[str, Any]
Expand Down Expand Up @@ -471,3 +472,14 @@ def score_f(key):
assert number_considered_combinations == score_function_call_count, (
f"Expected {number_considered_combinations} combinations to be considered, but got {score_function_call_count}."
)


def test_smooth_quant_param_grid():
matmul_expected_alpha_values = [0.15, 0.25, 0.5, 0.75, 0.95]

param_grid = _get_smooth_quant_param_grid()
smooth_quant_alphas = param_grid["advanced_parameters:smooth_quant_alphas"]

for i, matmul_alpha in enumerate(matmul_expected_alpha_values):
smooth_quant_alphas[i].matmul == matmul_alpha
smooth_quant_alphas[i].convolution == -1