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_as_view

def slice_as_view[dtype: DType, start_type: DType, end_type: DType, step_type: DType](tensor: TileTensor[dtype, Storage=tensor.Storage, address_space=tensor.address_space, linear_idx_type=tensor.linear_idx_type], starts: TileTensor[start_type, Storage=starts.Storage, address_space=starts.address_space, linear_idx_type=starts.linear_idx_type], ends: TileTensor[end_type, Storage=ends.Storage, address_space=ends.address_space, linear_idx_type=ends.linear_idx_type], steps: TileTensor[step_type, Storage=steps.Storage, address_space=steps.address_space, linear_idx_type=steps.linear_idx_type]) -> TileTensor[dtype, Layout[*?, *?], tensor.origin, address_space=tensor.address_space]

Returns a view of tensor sliced along every dimension.

For each axis, the corresponding entries in starts, ends, and steps are normalized and clamped, then the offset, stride, and extent of that dimension are adjusted to produce a zero-copy view of the source data.

Args:

Returns:

TileTensor[dtype, Layout[*?, *?], tensor.origin, address_space=tensor.address_space]

Was this page helpful?