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:
- βinput_buf (
TileTensor[input_type, Storage=input_buf.Storage, address_space=input_buf.address_space, linear_idx_type=input_buf.linear_idx_type]): Source tensor whose slice shape is computed. - βstart_buf (
TileTensor[start_type, Storage=start_buf.Storage, address_space=start_buf.address_space, linear_idx_type=start_buf.linear_idx_type]): One-dimensional tensor of starting indices, one per rank. - βstop_buf (
TileTensor[stop_type, Storage=stop_buf.Storage, address_space=stop_buf.address_space, linear_idx_type=stop_buf.linear_idx_type]): One-dimensional tensor of stopping indices (exclusive), one per rank. - βstep_buf (
TileTensor[step_type, Storage=step_buf.Storage, address_space=step_buf.address_space, linear_idx_type=step_buf.linear_idx_type]): One-dimensional tensor of strides, one per rank; each must be non-zero.
Returns:
IndexList[input_buf.LayoutType.rank]: An IndexList holding the extent of each dimension after slicing.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!