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
as_dynamic_row_major_1d
def as_dynamic_row_major_1d[dtype: DType](tensor: LayoutTensor[dtype, element_layout=tensor.element_layout, layout_int_type=tensor.layout_int_type, linear_idx_type=tensor.linear_idx_type, masked=tensor.masked, alignment=tensor.alignment]) -> LayoutTensor[dtype, Layout.row_major(Int(-1)), ImmutAnyOrigin]
Reinterprets a generic-address LayoutTensor as a 1-D dynamic row-major tensor.
The pointer and total element count are preserved; the result has an unknown-value row-major layout so it can be passed to routines that require a 1-D runtime-layout tensor without copying data.
Parameters:
- dtype (
DType): The element data type of the input tensor.
Args:
- tensor (
LayoutTensor[dtype, element_layout=tensor.element_layout, layout_int_type=tensor.layout_int_type, linear_idx_type=tensor.linear_idx_type, masked=tensor.masked, alignment=tensor.alignment]): The immutable generic-address tensor to reinterpret.
Returns:
LayoutTensor[dtype, Layout.row_major(Int(-1)), ImmutAnyOrigin]: A 1-D LayoutTensor with a row_major(UNKNOWN_VALUE) layout backed
by the same storage as tensor.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!