IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo function

transpose_4d_swap_middle

def transpose_4d_swap_middle[rank: Int, dtype: DType, //](output: TileTensor[dtype, Storage=output.Storage, linear_idx_type=output.linear_idx_type], input: TileTensor[dtype, Storage=input.Storage, linear_idx_type=input.linear_idx_type], perms: Pointer[Int, _safe=False], simplified_input_shape: IndexList[rank], simplified_rank: Int, ctx: Optional[DeviceContext] = None)

Transposes the middle two axes of a rank-4 tensor.

Maps an LxMxNxK input to an LxNxMxK output by swapping the M and N axes while copying contiguous K-sized slices.

Parameters:

  • ​rank (Int): Number of dimensions in the simplified_input_shape array (inferred).
  • ​dtype (DType): Element type of the input and output buffers (inferred).

Args: