This reference describes unreleased code on main; no release documents it yet.

rlmesh::ext::TensorExt

traitPreviewuse rlmesh::ext::TensorExt;[source]

Additional tensor constructors and layout access.

trait TensorExt: Sized

from_vec

required method[source]
fn from_vec(
    data: Vec<u8>,
    shape: &[usize],
    dtype: DType,
) -> Result<Self>

Adopt data as a C-contiguous tensor without copying.

zeros

required method[source]
fn zeros(shape: &[usize], dtype: DType) -> Result<Self>

A zero-filled tensor in fresh aligned storage.

from_storage

required method[source]
fn from_storage(
    storage: Storage,
    dtype: DType,
    shape: &[usize],
    element_strides: Option<&[usize]>,
    byte_offset: usize,
) -> Result<Self>

A view over storage with element strides (None: C-contiguous) and a byte offset.

stack

required method[source]
fn stack(tensors: &[Self]) -> Result<Self>

Stack same-shaped tensors along a new leading dimension.

unstack

required method[source]
fn unstack(&self) -> Result<Vec<Self>>

Split along the leading dimension.

storage

required method[source]
fn storage(&self) -> &Storage

The shared backing storage.

byte_offset

required method[source]
fn byte_offset(&self) -> usize

The first element’s offset into the storage, in bytes.

element_strides

required method[source]
fn element_strides(&self) -> Vec<usize>

Strides in elements.