Skip to content

Commit 713ef9e

Browse files
sdaultonfacebook-github-bot
authored andcommitted
acquisition function wrapper (#1532)
Summary: Pull Request resolved: #1532 Add a wrapper for modifying inputs/outputs. This is useful for not only probabilistic reparameterization, but will also simplify other integrated AFs (e.g. MCMC) as well as fixed feature AFs and things like prior-guided AFs Differential Revision: D41629186 fbshipit-source-id: 6dcfdb4ebf4dd316f361d1d3b0c9bfa1d54ff2d1
1 parent 5d3bdd4 commit 713ef9e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

botorch/acquisition/wrapper.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
#
4+
# This source code is licensed under the MIT license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
r"""
8+
A wrapper classes around AcquisitionFunctions to modify inputs and outputs.
9+
"""
10+
11+
from __future__ import annotations
12+
13+
from botorch.acquisition.acquisition import AcquisitionFunction
14+
from torch.nn import Module
15+
16+
17+
class AcquisitionFunctionWrapper(AcquisitionFunction):
18+
r"""Abstract acquisition wrapper."""
19+
20+
def __init__(self, acq_function: AcquisitionFunction) -> None:
21+
Module.__init__(self)
22+
self.__class__ = type(
23+
acq_function.__class__.__name__,
24+
(self.__class__, acq_function.__class__),
25+
{},
26+
)
27+
self.__dict__ = acq_function.__dict__
28+
self.acq_function = acq_function

0 commit comments

Comments
 (0)