pub struct TensorMap<E: CubePrimitive> { /* private fields */ }Expand description
A CUDA CUtensorMap object. Represents a tensor encoded with a lot of metadata, and is an
opaque packed object at runtime. Does not support retrieving any shapes or strides, nor does
it give access to the pointer. So these need to be passed separately in an aliased Tensor if needed.
Also see [cubecl_common::tma].
Implementations§
Source§impl<T: CubePrimitive> TensorMap<T>
 
impl<T: CubePrimitive> TensorMap<T>
Sourcepub fn buffer(&self) -> Tensor<Line<T>> ⓘ
 
pub fn buffer(&self) -> Tensor<Line<T>> ⓘ
Get a reference to the underlying buffer for the tensor map.
Sourcepub fn coordinate<I: Index, D: Index>(&self, _index: I, _dim: D) -> u32
 
pub fn coordinate<I: Index, D: Index>(&self, _index: I, _dim: D) -> u32
Obtain the coordinate corresponding to the given index of the tensor at dimension dim.
A coordinate is a list of indices corresponding to the multi-dimensional position of an element in the tensor.
The dim element in a coordinate is the position along the dim dimension of the tensor.
Sourcepub fn len(&self) -> u32
 
pub fn len(&self) -> u32
The number of vectorized elements in the tensor.
§Warning
The length will be affected by the vectorization factor. To obtain the number of elements, you should multiply the length by the vectorization factor.
Sourcepub fn buffer_len(&self) -> u32
 
pub fn buffer_len(&self) -> u32
The length of the buffer representing the tensor in terms of vectorized elements.
§Warning
The buffer length will be affected by the vectorization factor. To obtain the number of elements, you should multiply the length by the vectorization factor.
Sourcepub fn try_cast_unchecked<E: CubePrimitive>(&self) -> TensorMap<E>
 
pub fn try_cast_unchecked<E: CubePrimitive>(&self) -> TensorMap<E>
Try to cast the tensormap to the given type and panic if the type isn’t the same.
This function should only be used to satisfy the Rust type system, when two generic types are supposed to be the same.