rlmesh.Tensor
Native tensor value used by RLMesh value encoding.
Tensor(buffer: object, shape: Sequence[int], dtype: str) -> TensorAttributes
Methods
shape
property[source]property shape: list[int]dtype
property[source]property dtype: strndim
property[source]property ndim: intsize
property[source]property size: intnbytes
property[source]property nbytes: intstrides
property[source]property strides: list[int]Strides in bytes per dimension, C-order.
device
property[source]property device: strDevice holding the tensor data. Always "cpu".
buffer
property[source]property buffer: memoryviewis_contiguous
function[source]is_contiguous() -> boolWhether the elements are laid out C-contiguously.
reshape
function[source]reshape(shape: Sequence[int]) -> TensorA tensor with the same elements and a new shape. One dimension may
be -1 to infer its size from the element count. Shares the
underlying data when this tensor is contiguous.
copy
function[source]copy() -> TensorA deep copy backed by fresh storage.
from_dlpack
function[source]from_dlpack(obj: object) -> TensorImport a tensor from a DLPack capsule or any object implementing
__dlpack__. Accepts both legacy and versioned capsules; the
elements are always copied into fresh storage and the source
capsule is consumed.
tobytes
function[source]tobytes() -> bytes