Implementing kernel
C++ engine symbols that back this Python API.Return input with axes axis0 and axis1 exchanged.
NumPy-style spelling of pairwise axis transposition. Verbose alias of
swapdims; both names refer to the same composite.
Parameters
inputTensorInput tensor.
axis0intFirst axis to swap. Negative values count from the end.
axis1intSecond axis to swap. Negative values count from the end.
Returns
TensorTensor with the same data as input but with axis0 and
axis1 exchanged — a view of input's buffer on the CPU, so a
write through it reaches input; a copy on metal.
Notes
For a tensor with shape , the output shape is
As in the reference, the result is a view on the CPU: no data moves, only the two strides trade places.
Examples
>>> import lucid
>>> x = lucid.zeros((2, 3, 4))
>>> lucid.swapaxes(x, 0, 2).shape
(4, 3, 2)