Shape and axis operations #
Dynamic permutation: like permute, but returns an existential output shape.
PyTorch analogue: torch.permute / Tensor.permute (with runtime checks).
Instances For
Permutation with an expected output shape.
This calls permute? and checks that the computed shape equals sOut.
Instances For
Exchange two arbitrary axes and check the statically expected output shape.
The result is none when either axis is invalid or the transposed shape is not sOut.
Instances For
Reduce the last axis after checking that the tensor has nonempty dimensions.
Instances For
Core implementation for reductions over a runtime array of axes.
This lowers “reduce along axis k” to:
- permute axis
kto the last position, - call
reduceLast, and - optionally re-insert a singleton dimension when
keepdim = true.
reduceSumDims? and reduceMeanDims? specialize this operation.
Instances For
Dynamic multi-axis sum reduction (like torch.sum(x, dim=axes, keepdim=...)).
Instances For
Dynamic multi-axis mean reduction (like torch.mean(x, dim=axes, keepdim=...)).
Instances For
Softmax along any valid tensor dimension.
The selected dimension is moved to the end for the backend's row-softmax primitive and then moved
back. The reverse-swap theorem makes the result shape exactly s; no runtime shape check is needed.
Instances For
Log-softmax along any valid tensor dimension.