bijx.Shift¶
- class bijx.Shift[source]¶
Bases:
ScalarBijection
Shift transformation.
Applies element-wise shifting with a learnable shift parameter. This is a simpler version of
AffineLinear
without the scale term.Type: \([-\infty, \infty] \to [-\infty, \infty]\)
Transform: \(x + b\) where \(b\) is a learnable shift parameter
- Parameters:
shift (
Union
[Variable
,Array
,ndarray
,Sequence
[Union
[int
,Any
]]]) – Shift parameter specification.transform_shift (
Callable
|None
) – Function to transform shift (default: None/identity).rngs – Random number generators for parameter initialization.
Example
>>> bijection = Shift(rngs=rngs) >>> x = jnp.array([-1.0, 0.0, 1.0]) >>> y, log_det = bijection.forward(x, jnp.zeros(3)) >>> all(y == x) # Initially shift = 0, so y == x True
- __init__(shift=(), transform_shift=None, *, rngs=None)[source]¶
- Parameters:
shift (Variable | Array | ndarray | Sequence[int | Any])
transform_shift (Callable | None)
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.