Skip to content

Commit

Permalink
Update indexing in qLogNEI._get_samples_and_objectives (#2649)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2649

Fixes #2648

Positive index adds support for samples with multiple output dimensions.

Reviewed By: SebastianAment

Differential Revision: D66965221

fbshipit-source-id: 071fbc60494d63b8dcb3d448353ff70f48deda85
  • Loading branch information
saitcakmak authored and facebook-github-bot committed Dec 9, 2024
1 parent c1eb255 commit 299438b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions botorch/acquisition/logei.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,13 @@ def _get_samples_and_objectives(self, X: Tensor) -> tuple[Tensor, Tensor]:
if not self._cache_root:
samples_full = super().get_posterior_samples(posterior)
obj_full = self.objective(samples_full, X=X_full)
# Calculate the positive index for splitting the samples & objective values.
split_dim = len(obj_full.shape) - 1
# assigning baseline buffers so `best_f` can be computed in _sample_forward
self.baseline_samples, samples = samples_full.split([n_baseline, q], dim=-2)
self.baseline_obj, obj = obj_full.split([n_baseline, q], dim=-1)
self.baseline_samples, samples = samples_full.split(
[n_baseline, q], dim=split_dim
)
self.baseline_obj, obj = obj_full.split([n_baseline, q], dim=split_dim)
return samples, obj

# handle one-to-many input transforms
Expand Down

0 comments on commit 299438b

Please sign in to comment.