Skip to content

Commit bc4fac9

Browse files
committed
[no ci] Fix docstring of Adapter.apply
1 parent 1284694 commit bc4fac9

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

bayesflow/adapters/adapter.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,13 @@ def apply(
246246
247247
Parameters
248248
----------
249-
forward: callable, no lambda
250-
Function to transform the data in the forward pass.
251-
For the adapter to be serializable, this function has to be serializable
252-
as well (see Notes). Therefore, only proper functions and no lambda
253-
functions should be used here.
254-
inverse: callable, no lambda
255-
Function to transform the data in the inverse pass.
256-
For the adapter to be serializable, this function has to be serializable
257-
as well (see Notes). Therefore, only proper functions and no lambda
258-
functions should be used here.
249+
forward : str or np.ufunc
250+
The name of the NumPy function to use for the forward transformation.
251+
inverse : str or np.ufunc, optional
252+
The name of the NumPy function to use for the inverse transformation.
253+
By default, the inverse is inferred from the forward argument for supported methods.
254+
You can find the supported methods in
255+
:py:const:`~bayesflow.adapters.transforms.NumpyTransform.INVERSE_METHODS`.
259256
predicate : Predicate, optional
260257
Function that indicates which variables should be transformed.
261258
include : str or Sequence of str, optional
@@ -264,12 +261,6 @@ def apply(
264261
Names of variables to exclude from the transform.
265262
**kwargs : dict
266263
Additional keyword arguments passed to the transform.
267-
268-
Notes
269-
-----
270-
Important: This is only serializable if the forward and inverse functions are serializable.
271-
This most likely means you will have to pass the scope that the forward and inverse functions are contained in
272-
to the `custom_objects` argument of the `deserialize` function when deserializing this class.
273264
"""
274265
transform = FilterTransform(
275266
transform_constructor=NumpyTransform,

bayesflow/adapters/transforms/numpy_transform.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class NumpyTransform(ElementwiseTransform):
1717
The name of the NumPy function to apply in the inverse transformation.
1818
"""
1919

20+
#: Dict of `np.ufunc` that support automatic selection of their inverse.
2021
INVERSE_METHODS = {
2122
np.arctan: np.tan,
2223
np.exp: np.log,

0 commit comments

Comments
 (0)