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_copy
def slice_as_copy[dtype: DType, index_type: DType](output: TileTensor[dtype, Storage=output.Storage, address_space=output.address_space, linear_idx_type=output.linear_idx_type], tensor: TileTensor[dtype, Storage=tensor.Storage, address_space=tensor.address_space, linear_idx_type=tensor.linear_idx_type], start: TileTensor[index_type, Storage=start.Storage, address_space=start.address_space, linear_idx_type=start.linear_idx_type], end: TileTensor[index_type, Storage=end.Storage, address_space=end.address_space, linear_idx_type=end.linear_idx_type], step: TileTensor[index_type, Storage=step.Storage, address_space=step.address_space, linear_idx_type=step.linear_idx_type], ctx: DeviceContext)
Copies a slice of tensor into output using the given start, end, and step indices.
The slice of tensor is materialized into output by loading from a
temporary view and storing element-wise; output must have the same rank
as tensor.
Args:
- βoutput (
TileTensor[dtype, Storage=output.Storage, address_space=output.address_space, linear_idx_type=output.linear_idx_type]): Mutable destination tensor that receives the sliced data. - βtensor (
TileTensor[dtype, Storage=tensor.Storage, address_space=tensor.address_space, linear_idx_type=tensor.linear_idx_type]): Source tensor to slice. - βstart (
TileTensor[index_type, Storage=start.Storage, address_space=start.address_space, linear_idx_type=start.linear_idx_type]): One-dimensional tensor of starting indices, one per rank. - βend (
TileTensor[index_type, Storage=end.Storage, address_space=end.address_space, linear_idx_type=end.linear_idx_type]): One-dimensional tensor of stopping indices (exclusive), one per rank. - βstep (
TileTensor[index_type, Storage=step.Storage, address_space=step.address_space, linear_idx_type=step.linear_idx_type]): One-dimensional tensor of strides, one per rank; each must be non-zero. - βctx (
DeviceContext): Device context for the target execution backend.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!