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
copy_to_slice
def copy_to_slice[dtype: DType, start_type: DType, end_type: DType, step_type: DType, target: StringSlice[ImmStaticOrigin] = StringSlice("cpu")](buffer: TileTensor[dtype, Storage=buffer.Storage, address_space=buffer.address_space, linear_idx_type=buffer.linear_idx_type], in_slice: TileTensor[dtype, Storage=in_slice.Storage, address_space=in_slice.address_space, linear_idx_type=in_slice.linear_idx_type], start: TileTensor[start_type, Storage=start.Storage, address_space=start.address_space, linear_idx_type=start.linear_idx_type], end: TileTensor[end_type, Storage=end.Storage, address_space=end.address_space, linear_idx_type=end.linear_idx_type], step: TileTensor[step_type, Storage=step.Storage, address_space=step.address_space, linear_idx_type=step.linear_idx_type], context: DeviceContext)
Copies in_slice into the slice of buffer defined by start, end, and step.
The shape of in_slice must match the shape produced by slicing buffer
with the given indices; otherwise an error is raised. The copy is performed
element-wise over the sliced view of buffer.
Args:
- βbuffer (
TileTensor[dtype, Storage=buffer.Storage, address_space=buffer.address_space, linear_idx_type=buffer.linear_idx_type]): Mutable destination tensor whose slice is overwritten. - βin_slice (
TileTensor[dtype, Storage=in_slice.Storage, address_space=in_slice.address_space, linear_idx_type=in_slice.linear_idx_type]): Source tensor whose data is copied into the slice. - βstart (
TileTensor[start_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[end_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[step_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. - βcontext (
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!