Core DAG Primitives #
Constants, elementwise arithmetic, and standard sequential operations exposed as typed DAG nodes.
Basic DAG primitives #
Produce the all-zero tensor of a statically known shape.
Instances For
The zero DAG node denotes the all-zero tensor of its declared shape.
Produce the all-one tensor of a statically known shape.
Instances For
Dense linear layer in DAG form.
Inputs are ordered as [W, b, x]:
W : Tensor α [outDim, inDim],b : Tensor α [outDim],xhas shape[inDim].
The output has shape [outDim]. This is the DAG embedding of Primitive.linear, so the DAG and
sequential authoring surfaces share the same Spec semantics and TorchLean lowering path.
Instances For
Flatten a tensor to a rank-one tensor in DAG form.
Input: [x : TorchLean.Tensor s].
Output: Tensor α [Spec.Shape.size s].
This is the DAG embedding of Primitive.flatten, so it has exactly the same row-major view
semantics as the sequential primitive.
Instances For
Spatial and residual DAG primitives #
ReLU activation in DAG form.
Input: [x : s], output: s.
Semantics: elementwise $\max(x,0)$. This is parameter-free and derived from Primitive.relu.
Reference: Nair and Hinton (2010), "Rectified Linear Units Improve Restricted Boltzmann Machines".
Instances For
Add two tensors of the same shape.
Input shapes: [s, s], output shape: s.
This is the primitive used for residual/skip connections: $\mathrm{out}=\operatorname{main}(x)+x$. It is defined directly because the sequential surface is unary, while residual addition is genuinely multi-input.
Instances For
The pure meaning of the DAG addition node is pointwise tensor addition.
Subtract two tensors of the same shape.
Instances For
The pure meaning of the DAG subtraction node is pointwise tensor subtraction.
Multiply two tensors coordinatewise.
Instances For
The pure meaning of the DAG multiplication node is pointwise tensor multiplication.
Arbitrary-rank convolution in DAG form, with inputs ordered as [kernel, bias, x].
Instances For
Arbitrary-rank max pooling in DAG form.
Instances For
Batch normalization over an arbitrary spatial shape in DAG form.