class
SoftmaxTransform
extends
TransformSoftmaxTransform()Softmax transform mapping .
Pushes an unconstrained vector
onto the open -simplex via
. Operates on the
last axis; event_dim = 1.
The transform is over-parameterised: any constant shift along the softmax axis () yields the same , so it is not a true bijection. The standard convention used here is to anchor the inverse at (un-normalised log-probabilities), which is one canonical preimage.
Notes
Forward:
Inverse (canonical anchor):
Pseudo-Jacobian used in change-of-variable bookkeeping:
This is the convention that keeps the simplex-valued pushforward
consistent in flow stacks; for a true bijection between
and the simplex use
StickBreakingTransform instead.
Examples
>>> import lucid
>>> from lucid.distributions.transforms import SoftmaxTransform
>>> T = SoftmaxTransform()
>>> T(lucid.tensor([0.0, 1.0, 2.0]))
Tensor([...])Methods (1)
fn
log_abs_det_jacobian
→Tensorlog_abs_det_jacobian(x: Tensor, y: Tensor)Pseudo-Jacobian for the over-parameterised softmax.