PositiveT#

class brainstate.nn.PositiveT#

Transformation constraining parameters to be strictly positive (0, +∞).

This is a convenience class that provides a simple positive constraint using the exponential transformation with lower bound of 0.

The transformation is defined by:

\[\text{forward}(x) = e^x\]

The inverse transformation is:

\[\text{inverse}(y) = \log(y)\]

Examples

>>> transform = PositiveT()
>>> x = jnp.array([-1.0, 0.0, 1.0])
>>> y = transform.forward(x)
>>> # y ≈ [0.368, 1.0, 2.718]
forward(x)[source]#

Transform unbounded input to positive values.

Return type:

Array

inverse(y)[source]#

Transform positive input back to unbounded domain.

Return type:

Array

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