OneHot#

class bayesflow.adapters.transforms.OneHot(num_classes: int)[source]#

Bases: ElementwiseTransform

Changes data to be one-hot encoded.

Parameters:
num_classesint

Number of classes for the encoding.

get_config() → dict[source]#
forward(data: Tensor, **kwargs) → Tensor[source]#
inverse(data: Tensor, **kwargs) → Tensor[source]#
__call__(data: Tensor, inverse: bool = False, **kwargs) → Tensor#

Call self as a function.

classmethod from_config(config: dict, custom_objects=None)#
has_permutation_jacobian: ClassVar[bool] = False#

Whether the transform only moves values around, i.e., has a permutation Jacobian.

log_det_jac(data: Tensor, inverse: bool = False, **kwargs) → Tensor | None#