pub struct TensorMap<E: CubePrimitive, K: TensorMapKind> { /* 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_runtime::tma.
Implementations§
Source§impl<T: Scalar, K: TensorMapKind> TensorMap<T, K>
impl<T: Scalar, K: TensorMapKind> TensorMap<T, K>
Sourcepub fn coordinate(&self, _index: usize, _dim: usize) -> usize
pub fn coordinate(&self, _index: usize, _dim: usize) -> usize
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) -> usize
pub fn len(&self) -> usize
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) -> usize
pub fn buffer_len(&self) -> usize
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 downcast<E: CubePrimitive>(&self) -> TensorMap<E, K>
pub fn downcast<E: CubePrimitive>(&self) -> TensorMap<E, K>
Downcast 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.
pub fn __expand_stride( scope: &Scope, expand: NativeExpand<TensorMap<T, K>>, dim: NativeExpand<usize>, ) -> NativeExpand<usize>
pub fn __expand_shape( scope: &Scope, expand: NativeExpand<TensorMap<T, K>>, dim: NativeExpand<usize>, ) -> NativeExpand<usize>
pub fn __expand_coordinate( scope: &Scope, expand: NativeExpand<TensorMap<T, K>>, index: NativeExpand<usize>, dim: NativeExpand<usize>, ) -> NativeExpand<usize>
pub fn __expand_len( scope: &Scope, expand: NativeExpand<TensorMap<T, K>>, ) -> NativeExpand<usize>
pub fn __expand_buffer_len( scope: &Scope, expand: NativeExpand<TensorMap<T, K>>, ) -> NativeExpand<usize>
pub fn __expand_rank( scope: &Scope, expand: NativeExpand<TensorMap<T, K>>, ) -> NativeExpand<usize>
Trait Implementations§
Source§impl<E: Clone + CubePrimitive, K: Clone + TensorMapKind> Clone for TensorMap<E, K>
impl<E: Clone + CubePrimitive, K: Clone + TensorMapKind> Clone for TensorMap<E, K>
impl<E: CubePrimitive, K: TensorMapKind> Copy for TensorMap<E, K>
Source§impl<E: CubePrimitive, K: TensorMapKind> CubeType for TensorMap<E, K>
impl<E: CubePrimitive, K: TensorMapKind> CubeType for TensorMap<E, K>
type ExpandType = NativeExpand<TensorMap<E, K>>
Source§impl<E: CubePrimitive, K: TensorMapKind> LaunchArg for TensorMap<E, K>
impl<E: CubePrimitive, K: TensorMapKind> LaunchArg for TensorMap<E, K>
Source§type RuntimeArg<R: Runtime> = TensorMapArg<R, K>
type RuntimeArg<R: Runtime> = TensorMapArg<R, K>
Source§type CompilationArg = ()
type CompilationArg = ()
fn register<R: Runtime>( arg: Self::RuntimeArg<R>, launcher: &mut KernelLauncher<R>, ) -> Self::CompilationArg
Source§fn expand(
_arg: &Self::CompilationArg,
builder: &mut KernelBuilder,
) -> NativeExpand<TensorMap<E, K>>
fn expand( _arg: &Self::CompilationArg, builder: &mut KernelBuilder, ) -> NativeExpand<TensorMap<E, K>>
KernelBuilder.Source§impl<E: CubePrimitive, K: TensorMapKind> Vectorized for TensorMap<E, K>
impl<E: CubePrimitive, K: TensorMapKind> Vectorized for TensorMap<E, K>
fn vector_size(&self) -> VectorSize
fn __expand_vector_size(_scope: &Scope, this: &Self::ExpandType) -> VectorSize
Auto Trait Implementations§
impl<E, K> Freeze for TensorMap<E, K>
impl<E, K> RefUnwindSafe for TensorMap<E, K>where
E: RefUnwindSafe,
K: RefUnwindSafe,
impl<E, K> Send for TensorMap<E, K>
impl<E, K> Sync for TensorMap<E, K>
impl<E, K> Unpin for TensorMap<E, K>
impl<E, K> UnsafeUnpin for TensorMap<E, K>
impl<E, K> UnwindSafe for TensorMap<E, K>where
E: UnwindSafe,
K: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more