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

slice_shape

def slice_shape[input_type: DType, start_type: DType, stop_type: DType, step_type: DType](input_buf: TileTensor[input_type, Storage=input_buf.Storage, address_space=input_buf.address_space, linear_idx_type=input_buf.linear_idx_type], start_buf: TileTensor[start_type, Storage=start_buf.Storage, address_space=start_buf.address_space, linear_idx_type=start_buf.linear_idx_type], stop_buf: TileTensor[stop_type, Storage=stop_buf.Storage, address_space=stop_buf.address_space, linear_idx_type=stop_buf.linear_idx_type], step_buf: TileTensor[step_type, Storage=step_buf.Storage, address_space=step_buf.address_space, linear_idx_type=step_buf.linear_idx_type]) -> IndexList[input_buf.LayoutType.rank]

Computes the shape that results from slicing input_buf with the given start, stop, and step tensors.

Validates that the index tensors each have one entry per rank of input_buf and that no step is zero, then normalizes and clamps the indices per axis to determine the output extent along each dimension.

Args:

Returns:

IndexList[input_buf.LayoutType.rank]: An IndexList holding the extent of each dimension after slicing.