CUDA Tape Operations: Elementwise Nodes #
Elementwise ops #
The backward closures below return newly allocated gradient buffers. When a derivative uses intermediate CUDA buffers, it releases those intermediates before returning the final gradient. The returned buffers are owned by the tape/gradient accumulator; workspace buffers are owned locally.
Pointwise addition node for two tensors with the same shape.
Instances For
Pointwise subtraction node for two tensors with the same shape.
Instances For
Pointwise multiplication node for two tensors with the same shape.
Instances For
Direct pointwise negation and its sign-reversing pullback.
Instances For
Multiply by a scalar constant.
Instances For
Pointwise absolute-value node.
Instances For
Pointwise square-root node using the CUDA buffer derivative convention.
Instances For
Clamp each element to [lo, hi].
Instances For
Pointwise maximum node. Distinct parents split ties according to Buffer.maxBwd.
Repeated references contribute the upstream value once, before graph accumulation.
Instances For
Pointwise minimum node. Distinct parents split ties according to Buffer.minBwd.
Repeated references use the coalesced-contribution convention of Tape.max.
Instances For
Pointwise division node with the usual quotient-rule backward closure.
Instances For
Pointwise ReLU node with zero derivative on the nonpositive branch.
Instances For
Pointwise exponential node; backward recomputes exp x as local workspace.
Instances For
Elementwise sine with VJP cos(x) * dLdy.
The cosine buffer belongs to this backward call and is released after multiplication. The input and upstream gradient remain owned by the tape.
Instances For
Elementwise cosine with VJP -sin(x) * dLdy, releasing both temporary buffers.
Instances For
Pointwise natural-log node; callers are responsible for the positive-domain convention.
Instances For
Elementwise reciprocal 1/x.
Instances For
Elementwise log(softplus(x) + ε).
The caller must choose ε positive after conversion to binary32 to keep a rounded-zero softplus
away from log(0). This operation does not validate ε or guarantee finite results for nonfinite
inputs.
Instances For
Direct sigmoid values and the input-based weighted pullback.
Instances For
Direct tanh values and the input-based weighted pullback.
Instances For
SiLU as one CUDA tape node. ATen evaluates the split-exponential value and local VJP.
Instances For
Tanh-approximate GELU as one CUDA tape node.
The adapter evaluates the staged pointwise formula with ATen operations. TorchLean records the
node and owns its VJP rule through Activation.geluDerivSpec; one tape node does not imply one
GPU kernel launch.
Instances For
Pointwise softplus node with sigmoid derivative.