CUDA Tape Operations: Normalization and Row Softmax #
Record weighted logits cross-entropy and its two native numerical pullbacks.
Instances For
Record mean teacher-logit cross-entropy. The existing tape owns the student pullback; ATen evaluates its numerical formula without native graph recording.
Instances For
Normalization #
LayerNorm over the last dimension for (seqLen, embedDim) buffers.
The tape records one normalization operation and keeps TorchLean's usual VJP. The native primitive evaluates the forward formula and that VJP with LibTorch tensor operations; intermediate tensors remain internal to the primitive.
epsilon is added to the variance before taking the square root. Backward reuses the normalized
input and inverse standard deviation saved by forward, so both passes use the caller's value.
Instances For
Batch normalization over every axis after the channel axis.
The spatial shape is folded to one contiguous dimension for the CUDA reduction. This is a view of the storage layout, not a rank-specific implementation.
Instances For
Softmax (last axis, row folding) #
All leading dimensions are folded into one row axis; normalization acts independently on the last axis at any rank. Empty tensors retain their shape. A scalar softmax is one, and a scalar log-softmax is zero; both have zero cotangent.
Record a row operation whose VJP uses the saved output.
The scalar forward function runs only after input validation. Empty tensors are copied; for non-scalar, nonempty tensors, row-dimension validation precedes input lookup.
Instances For
Record a last-axis softmax on the tape, returning the extended tape and the new node id.
Instances For
The top-k mask along the last axis (Spec.MoE.topKMaskSpec), as a node that receives no
gradient. A scalar is a row of one entry, kept when 0 < k.
Instances For
Stable log-softmax along the last axis, implemented directly on CUDA buffers.