Operation-Polymorphic Tensor Programs #
Program is model code abstract over a tensor-operation interpreter. Supplying the eager
interpreter executes operations immediately and records a dynamic tape; supplying the typed-graph
recorder, as the autograd transforms do, records reusable shape-indexed SSA data.
Program.Data also accepts non-differentiable tensor inputs with their own element type, such as
token indices. map applies an operation over a specified prefix shape; linear, convolution,
pooling, normalization and attention accept those prefixes without separate batched variants.
The operation-polymorphic surface shared by the eager tape and the typed-graph recorder.
Prefix-polymorphic derived operations #
Apply a single-sample operation independently over an arbitrary prefix shape.
Instances For
Affine transformation of the final axis, independently over any prefix shape.
Instances For
Rank-polymorphic convolution over channels-first inputs with any prefix shape.
Instances For
Rank-polymorphic transpose convolution over channels-first inputs with any prefix shape.
Instances For
Rank-polymorphic max pooling over channels-first inputs with any prefix shape.
Instances For
Rank-polymorphic average pooling over channels-first inputs with any prefix shape.
Instances For
Batched rank-polymorphic smooth maximum pooling over channels-first inputs.
Instances For
Layer normalization over the final axis of an arbitrary tensor.
Backends expose a matrix-shaped fused primitive. This wrapper gives that primitive its rank-polymorphic TorchLean interface by flattening the leading axes once and restoring them after the operation. Empty leading axes produce the unique empty tensor without invoking a backend kernel that requires a positive row count.
Instances For
Self-attention over any prefix shape, with an optional output-feature bias.
Instances For
An execution-polymorphic differentiable tensor program.
Instances For
An execution-polymorphic program with differentiable tensors followed by non-differentiable data
tensors. The data element type is explicit; for example, token models may use Fin vocab so an
out-of-range token is unrepresentable.