IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Mojo trait

CopyPolicy

The CopyPolicy trait defines requirements needed for a tensor to be copied.

These requirements check the compatibility of the source and destination tensors.

Implemented traits​

AnyType, Copyable, DevicePassable, ImplicitlyCopyable, Movable

Required methods​

verify_source_tensor​

static def verify_source_tensor(src: LayoutTensor[address_space=src.address_space, element_layout=src.element_layout, layout_int_type=src.layout_int_type, linear_idx_type=src.linear_idx_type, masked=src.masked, alignment=src.alignment])

A static function that verifies the source tensor is compatible with the copy operation. If the tensor is not valid compilation will fail.

Args:

verify_destination_tensor​

static def verify_destination_tensor(dst: LayoutTensor[address_space=dst.address_space, element_layout=dst.element_layout, layout_int_type=dst.layout_int_type, linear_idx_type=dst.linear_idx_type, masked=dst.masked, alignment=dst.alignment])

A static function that verifies the destination tensor is compatible with the copy operation. If the tensor is not valid compilation will fail.

Args:

Was this page helpful?