Skip to content

Commit e59a12f

Browse files
sdaultonfacebook-github-bot
authored andcommitted
acquisition function wrapper
Summary: 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: d2e6a32012e199871a14606742153b84b8637d36
1 parent c296802 commit e59a12f

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)