Primitive lowering for rearrange #
A checked rearrange lowers directly to three tensor operations:
- reshape physical input groups into elementary input axes;
- reindex those axes into output order;
- reshape elementary output axes into physical output groups.
The definitions operate on the existing checked transformation rather than introducing an operator-specific program wrapper. The main theorem proves that this explicit tensor program equals the independent coordinate denotation for every scalar type and every valid checked rearrange.
A checked input shape has the same size as its elementary-axis shape.
A checked output shape has the same size as its elementary-axis shape.
Ungrouping certified tensor axes is row-major reshape followed by conversion to a named elementary-axis tuple.
Converting an input tensor coordinate to named elementary axes factors through the row-major reshape used by lowering.
Converting an output tensor coordinate to named elementary axes factors through the row-major reshape used by lowering.
Execute the explicit reshape, axis permutation, and reshape stages.
Instances For
Primitive rearrange lowering is correct for every scalar type and input tensor.