From b7914258b873d4709825e86b6eeb51f6255c595a Mon Sep 17 00:00:00 2001 From: stijn Date: Mon, 6 Oct 2025 16:23:28 +0200 Subject: [PATCH] Fix issue 335, `ValueError: (...) is not in list` --- kernel_tuner/strategies/bayes_opt.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel_tuner/strategies/bayes_opt.py b/kernel_tuner/strategies/bayes_opt.py index f155bcd0..a1365c78 100644 --- a/kernel_tuner/strategies/bayes_opt.py +++ b/kernel_tuner/strategies/bayes_opt.py @@ -501,8 +501,11 @@ def draw_latin_hypercube_samples(self, num_samples: int) -> list: normalized_param_config = self.normalize_param_config(param_config) try: index = self.find_param_config_index(normalized_param_config) - indices.append(index) - normalized_param_configs.append(normalized_param_config) + + # returned indices must not contain duplicates + if index not in indices: + indices.append(index) + normalized_param_configs.append(normalized_param_config) except ValueError: """With search space restrictions, the search space may not be a cartesian product of parameter values. It is thus possible for LHS to generate a parameter combination that is not in the actual searchspace.