Mojo function
copy_tensor
copy_tensor[dtype: DType, rank: Int, //, *, target: StringSlice[StaticConstantOrigin] = "cpu", _trace_name: StringSlice[StaticConstantOrigin] = "mogg.copy_tensor"](dst: ManagedTensorSlice[dst.io_spec, static_spec=dst.static_spec], src: ManagedTensorSlice[src.io_spec, static_spec=src.static_spec], ctx: DeviceContextPtr)
Copy elements from src to dst using fused load and store.
Reads each element of src via _fused_load (dispatches through the
fused input lambda when present, falls back to a direct load otherwise)
and writes to dst through its fused output store, dispatching via
foreach.
Parameters:
- dtype (
DType): The element type of both tensor slices. - rank (
Int): The rank of both tensor slices. - target (
StringSlice): The target device (e.g. "cpu", "gpu"). - _trace_name (
StringSlice): Name shown in the execution trace.
Args:
- dst (
ManagedTensorSlice): The destination tensor slice. - src (
ManagedTensorSlice): The source tensor slice. - ctx (
DeviceContextPtr): The device context.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!