IR axis operations #
IR axis-ops runtime tutorial.
This tutorial constructs and evaluates three IR operations with an explicit axis:
softmax axis(PyTorch:torch.softmax(x, dim=axis))concat axis(PyTorch:torch.cat(xs, dim=axis))layernorm axisPyTorch:F.layer_norm(x, normalized_shape=x.shape[axis:])
Each operation accepts any in-bounds tensor dimension. The implementation may move that dimension to an innermost position while evaluating an optimized kernel, but its public semantics preserves the original shape and dimension numbering. Forward graph execution reports unsupported backend cases explicitly.
Run:
lake exe torchlean ir_axis_ops --execution eager
Command-line help for the IR axis-ops tutorial.
Instances For
Tensor Shapes #
These shapes illustrate an axis that is neither first nor last.
Instances For
Instances For
Instances For
Small IR Graphs #
LayerNorm over axis 1 of a rank-three tensor, the interesting case because the normalized axis is neither the first nor the last.
Instances For
Concatenation along axis 1, joining a [2, 3, 4] and a [2, 5, 4] tensor into [2, 8, 4].
Instances For
Runner Helpers #
Print a compact preview of a tensor.
Instances For
Evaluate an example graph through the runtime API and print its selected output.
Instances For
Run every axis-op example at scalar type α.
Generic in α so the tutorial can be run under native Float or under the bit-level IEEE model
with no change to the graphs.
Instances For
Runtime-selected entrypoint body for the axis-ops tutorial.