Skip to content

[Bug]: RuntimeError: Index out of bounds #3112

@AdrianSosic

Description

@AdrianSosic

What happened?

I have snippet of code that works without problems on macOS but throws a RuntimeError on Linux/Windows.
So far, I haven't fully figured out what is going on, but what I observed:

  • The MultiTaskGP.task_mapper is assigned [nan, 0]
  • The above is perhaps still expected, but in GPyTorch, these nan values get translated into 9223372036854775808, i.e. some integer overflow is happening (the number is the -2ˆ63)

Please provide a minimal, reproducible example of the unexpected behavior.

import torch
from botorch.acquisition import qLogExpectedImprovement
from botorch.acquisition.objective import IdentityMCObjective
from botorch.models import MultiTaskGP
from botorch.optim import optimize_acqf_mixed

train_x = torch.tensor([[1.0, 10.0], [1.0, 20.0]])
train_y = torch.tensor([[10.0], [20.0]])
gp = MultiTaskGP(
    train_x,
    train_y,
    task_feature=0,
    output_tasks=[0, 1],
    all_tasks=[0, 1],
    validate_task_values=False,
)


acqf = qLogExpectedImprovement(gp, 0.0, objective=IdentityMCObjective())
bounds = torch.tensor([[0.0, 0.0], [1.0, 5.0]])
q = 1
num_restarts = 10
raw_samples = 64
fixed_features_list = [{0: 0}, {0: 1}]

candidate, acqf_value = optimize_acqf_mixed(
    acqf,
    bounds=bounds,
    q=q,
    num_restarts=num_restarts,
    raw_samples=raw_samples,
    fixed_features_list=fixed_features_list,
)

print(candidate)
print(acqf_value)

Please paste any relevant traceback/logs produced by the example provided.

RuntimeError: index -9223372036854775808 is out of bounds for dimension 2 with size 1

BoTorch Version

0.16.1

Python Version

3.10.19

Operating System

Linux/Windows

(Optional) Describe any potential fixes you've considered to the issue outlined above.

No response

Pull Request

None

Code of Conduct

  • I agree to follow BoTorch's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions