Skip to content
Closed
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
6 changes: 6 additions & 0 deletions botorch/models/deterministic.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
class DeterministicModel(EnsembleModel):
"""Abstract base class for deterministic models."""

def _set_transformed_inputs(self):
"""Overwrites the parent method to prevent raise of
warning "Could not update `train_inputs` with transformed inputs."
"""
return None

@abstractmethod
def forward(self, X: Tensor) -> Tensor:
r"""Compute the (deterministic) model output at X.
Expand Down
11 changes: 3 additions & 8 deletions test/models/test_deterministic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import warnings

import torch
from botorch.acquisition.objective import ScalarizedPosteriorTransform
Expand Down Expand Up @@ -149,15 +148,11 @@ def test_with_transforms(self):
# check that the posterior output agrees with the manually transformed one
test_X = torch.rand(3, dim)
expected_Y, _ = octf.untransform(model.forward(intf(test_X)))
with warnings.catch_warnings(record=True) as ws:
posterior = model.posterior(test_X)
msg = "does not have a `train_inputs` attribute"
self.assertTrue(any(msg in str(w.message) for w in ws))
posterior = model.posterior(test_X)
self.assertAllClose(expected_Y, posterior.mean)
# check that model.train/eval works and raises the warning
# check that model.train/eval works
model.train()
with self.assertWarns(RuntimeWarning):
model.eval()
model.eval()

def test_posterior_transform(self):
def f(X):
Expand Down
Loading