AffineTransform
TransformAffineTransform(loc: Tensor | float, scale: Tensor | float)Element-wise affine bijection .
The fundamental location-scale transform. Composing with a
standard Normal yields ; it underpins virtually every reparameterised
sampler in the codebase. Bijective with sign matching
sign(scale); the implementation fixes self.sign = +1, so the
caller is responsible for ensuring scale > 0.
Parameters
Notes
Forward: .
Inverse: .
Log Jacobian determinant (broadcast to x.shape):
For element-wise application (event_dim = 0) this is summed by
IndependentTransform if the caller reinterprets trailing
dims as event dims.
Examples
>>> import lucid
>>> from lucid.distributions.transforms import AffineTransform
>>> T = AffineTransform(loc=1.0, scale=2.0)
>>> T(lucid.tensor(3.0))
Tensor(7.0)Used by 1
Constructors
1Instance methods
1Constant log-Jacobian .
The Jacobian of
is just scale, so the log-determinant is constant in x.
We add zeros_like(x) so the result broadcasts to x's
full shape (callers expect element-wise log-Jacobians).
Parameters
Returns
Tensorlog|scale| broadcast to x.shape.