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:
- 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]): The source tensor that will be copied from.
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:
- 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]): The destination tensor that will be copied to.