credit.postblock.exp#

Classes#

ExpTransform

Inverse of the LogTransform preblock: converts log-space values to physical space.

Module Contents#

class credit.postblock.exp.ExpTransform(variables: list[str], eps: float = 1e-08, base: str = 'e', key: str = 'y_processed')#

Bases: credit.postblock.base.BasePostblock

Inverse of the LogTransform preblock: converts log-space values to physical space.

Inverts y = log_base(x + eps) - log_base(eps) back to x = base^(y + log_base(eps)) - eps.

eps and base must match those used in the corresponding LogTransform preblock.

variables supports the same shorthand as the scaler: an empty list transforms every variable; partial paths (e.g. "era5/prognostic") expand to all variables under that hierarchy. Expansion happens lazily on the first forward call.

Config example:

type: "exp_transform"
args:
    variables:
        - "era5/prognostic/3d/Q"
    eps: 1.0e-8      # must match LogTransform eps
    base: "e"        # must match LogTransform base

# or inverse-transform all variables:
type: "exp_transform"
args:
    variables: []
variables#
variables_expanded = False#
key = 'y_processed'#
_eps#
_base = 'e'#
_exp(x: torch.Tensor) torch.Tensor#

Apply base-specific exponentiation: e^x, 2^x, or 10^x.

forward(batch_dict: dict) dict#