ExpT#

class brainstate.nn.ExpT(lower)#

Exponential transformation mapping (-inf, +inf) to (lower, +inf).

Equivalent to Log; provided for explicit naming.

Notes

Important

forward uses save_exp(), which clips the exponent at max_value=20. Inputs with x > 20 saturate at lower + exp(20) * unit and the transform is not invertible there; the analytic log_abs_det_jacobian (sum(x)) is only valid in the unclipped region. Keep inputs within roughly [-20, 20].

forward(x)[source]#

Apply the forward transformation.

Transforms input from the unconstrained domain to the constrained domain. This method implements the mathematical function \(y = f(x)\) where \(x\) is in the unconstrained space and \(y\) is in the target domain.

Parameters:

x (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Input array in the unconstrained domain.

Returns:

Transformed output in the constrained domain.

Return type:

Array

Notes

Implementations must ensure numerical stability and handle boundary conditions appropriately.

inverse(y)[source]#

Apply the inverse transformation.

Transforms input from the constrained domain back to the unconstrained domain. This method implements the mathematical function \(x = f^{-1}(y)\) where \(y\) is in the constrained space and \(x\) is in the unconstrained domain.

Parameters:

y (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Input array in the constrained domain.

Returns:

Transformed output in the unconstrained domain.

Return type:

Array

Notes

Implementations must ensure that inverse(forward(x)) = x for all valid x, and forward(inverse(y)) = y for all y in the target domain.

log_abs_det_jacobian(x, y)[source]#

For exp transform: d/dx[exp(x)] = exp(x), so log|det J| = sum(x).

Return type:

Array