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:
- βtensor (
TileTensor[dtype, Storage=tensor.Storage, address_space=tensor.address_space, linear_idx_type=tensor.linear_idx_type]): Source tensor to slice. - βstarts (
TileTensor[start_type, Storage=starts.Storage, address_space=starts.address_space, linear_idx_type=starts.linear_idx_type]): One-dimensional tensor of starting indices, one per rank. - βends (
TileTensor[end_type, Storage=ends.Storage, address_space=ends.address_space, linear_idx_type=ends.linear_idx_type]): One-dimensional tensor of stopping indices (exclusive), one per rank. - βsteps (
TileTensor[step_type, Storage=steps.Storage, address_space=steps.address_space, linear_idx_type=steps.linear_idx_type]): One-dimensional tensor of strides, one per rank; each must be non-zero.
Returns:
TileTensor[dtype, Layout[*?, *?], tensor.origin, address_space=tensor.address_space]
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!