bijx.Tanh¶
- class bijx.Tanh[source]¶
Bases:
ScalarBijection
Hyperbolic tangent bounded transform.
Maps the real line to the interval \([-1, 1]\) using the hyperbolic tangent function, providing a symmetric bounded transformation.
Type: \([-\infty, \infty] \to [-1, 1]\)
Transform: \(\tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}}\)
Example
>>> bijection = Tanh() >>> x = jnp.array([-2.0, 0.0, 2.0]) >>> y, log_det = bijection.forward(x, jnp.zeros(3))
- __init__(*args, **kwargs)¶
Methods
forward
(x, log_density, **kwargs)Apply forward transformation with log-density update.
fwd
(x, **kwargs)Apply forward transformation.
invert
()Create an inverted version of this bijection.
log_jac
(x, y, **kwargs)Compute log absolute determinant of the Jacobian.
rev
(y, **kwargs)Apply reverse (inverse) transformation.
reverse
(y, log_density, **kwargs)Apply reverse transformation with log-density update.
- log_jac(x, y, **kwargs)[source]¶
Compute log absolute determinant of the Jacobian.
- Parameters:
x – Input values where Jacobian is computed.
y – Output values corresponding to x (i.e., y = fwd(x)).
**kwargs – Additional transformation-specific arguments.
- Returns:
Log absolute Jacobian determinant \(\log \abs{f'(x)}\) with same shape as x.