LogT#

class brainstate.nn.LogT(lower)#

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

Forward maps unconstrained input x to the positive domain via:

y = lower + exp(x) * unit

Inverse maps back using:

x = log((y - lower) / unit)

Parameters:

lower (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Lower bound of the target interval.

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