Elementwise tape nodes #
Reusable NodeFDerivCorrect wrappers for scalar functions lifted pointwise to tensors, including
common activations such as ReLU, sigmoid, tanh, SiLU, GELU, ELU, and safe differentiable variants.
CtxVec.get specialized to vector shapes.
Instances For
CtxVec.getCLM specialized to vector shapes .dim n .scalar.
Instances For
The vector-shaped context lookup agrees with getVec, size cast included.
Coordinate form of the general context lookup.
Inject a Vec n into a vectorized context at idx (fills other blocks with zeros).
Instances For
Reading a context slot is adjoint to writing that slot: ⟪x, single idx v⟫ = ⟪get idx x, v⟫.
This is the adjointness fact behind every elementwise node's VJP. A node reads one slot and writes one slot, so its reverse pass is the transpose of its forward projection, and that is exactly what this equation says.
Elementwise node: apply a scalar function pointwise on a context entry.
Instances For
Analytic correctness for elemwise nodes from a scalar HasDerivAt hypothesis.
Instances For
Pointwise analytic correctness for elemwise nodes from a coordinatewise HasDerivAt
hypothesis.
Instances For
Runtime relu node (elementwise; nondifferentiable at zero).
Instances For
Pointwise NodeFDerivCorrectAt for relu under the assumption that inputs are nonzero.
Instances For
Runtime abs node (elementwise; nondifferentiable at zero).
Instances For
Pointwise NodeFDerivCorrectAt for abs under the assumption that inputs are nonzero.
Instances For
Runtime log node (elementwise; differentiable only away from zero).
Instances For
Pointwise NodeFDerivCorrectAt for log under the assumption that inputs are nonzero.
Instances For
Elementwise inverse node (differentiable only away from zero).
Instances For
Pointwise NodeFDerivCorrectAt for inv under the assumption that inputs are nonzero.
Instances For
Elementwise "clamped sqrt": sqrt (max x 0) (differentiable on x > 0).
Instances For
Pointwise NodeFDerivCorrectAt for sqrtClamp under the assumption that inputs are strictly
positive.
Instances For
Runtime sqrt node (elementwise; nondifferentiable at zero).
Instances For
Pointwise NodeFDerivCorrectAt for sqrt under the assumption that inputs are nonzero.
Instances For
Runtime scalar logistic node, applied elementwise.
Rank-one and matrix softmax use the dedicated last-axis softmax nodes below; this node is the one-dimensional logistic map used by scalar activations.
Instances For
Global NodeFDerivCorrect for logistic (uses the scalar derivative lemma).
Instances For
Runtime sigmoid node (elementwise).
Instances For
Global NodeFDerivCorrect for sigmoid.
Instances For
Runtime tanh node (elementwise).
Instances For
Global NodeFDerivCorrect for tanh.
Instances For
Runtime softplus node (elementwise, smooth ReLU surrogate).
Instances For
Global NodeFDerivCorrect for softplus.
Instances For
Runtime silu node (elementwise).
Instances For
Global NodeFDerivCorrect for SiLU.
Instances For
Runtime tanh-approximate gelu node (elementwise).
Instances For
Global NodeFDerivCorrect for tanh-approximate GELU.
Instances For
Runtime safeLog node (elementwise, always-defined log surrogate).
Instances For
Global NodeFDerivCorrect for safeLog (requires 0 < ε).
Instances For
Runtime smoothAbs node (elementwise, smooth abs surrogate).
Instances For
Global NodeFDerivCorrect for smoothAbs (requires 0 < ε).
Instances For
Runtime exp node (elementwise).
Instances For
Global NodeFDerivCorrect instance for the elementwise exponential.
Instances For
Runtime sinh node (elementwise).
Instances For
Global NodeFDerivCorrect for elementwise hyperbolic sine.
Instances For
Runtime cosh node (elementwise).
Instances For
Global NodeFDerivCorrect for elementwise hyperbolic cosine.
Instances For
Runtime elu node (elementwise; nondifferentiable at zero unless alpha = 1).
Instances For
Pointwise NodeFDerivCorrectAt for ELU under the usual no-coordinate-at-the-kink assumption.
For arbitrary alpha, ELU has left derivative alpha and right derivative 1 at zero. Keeping the
hypothesis here avoids baking PyTorch's subgradient convention into a mathematical derivative
theorem.
Instances For
Unary node applying an analytically-correct OpSpec at a context index.
Instances For
NodeFDerivCorrect for unaryOp.
Instances For
Linear layer as a single tape node (fixed weights/bias in the Spec.LinearSpec).
Instances For
NodeFDerivCorrect for linear: the node derivative matches the spec's OpSpec derivative.