From 59f686be6f3cc68cf61604a7af373550b8f752eb Mon Sep 17 00:00:00 2001 From: Sait Cakmak Date: Tue, 28 Jul 2026 18:18:53 -0700 Subject: [PATCH] Fix SobolEngine.fast_forward with n=0 (#5262) Summary: A recent torch change made it so that n=0 is not a valid input to SobolEngine.fast_forward. This diff should fix the resulting failures (in internal CI). ___ Differential Revision: D113989171 --- ax/analysis/plotly/tests/test_sensitivity.py | 1 - ax/generators/random/sobol.py | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ax/analysis/plotly/tests/test_sensitivity.py b/ax/analysis/plotly/tests/test_sensitivity.py index fd87c83bc46..80fbdcecb50 100644 --- a/ax/analysis/plotly/tests/test_sensitivity.py +++ b/ax/analysis/plotly/tests/test_sensitivity.py @@ -5,7 +5,6 @@ # pyre-strict -from itertools import product from unittest.mock import patch from ax.adapter.registry import Generators diff --git a/ax/generators/random/sobol.py b/ax/generators/random/sobol.py index 3948e3e0f32..8c76ca854e3 100644 --- a/ax/generators/random/sobol.py +++ b/ax/generators/random/sobol.py @@ -66,7 +66,9 @@ def init_engine(self, n_tunable_features: int) -> SobolEngine: if not self._engine: self._engine = SobolEngine( dimension=n_tunable_features, scramble=self.scramble, seed=self.seed - ).fast_forward(self.init_position) + ) + if self.init_position > 0: + self._engine.fast_forward(self.init_position) return self._engine @property