pub struct Matrix<C: CubeType, S: MatrixScope = Plane> { /* private fields */ }Expand description
A matrix represent a 2D grid of numbers.
They can either be in a row major or a column major format.
Implementations§
Source§impl<C: CubePrimitive, S: MatrixScope> Matrix<C, S>
impl<C: CubePrimitive, S: MatrixScope> Matrix<C, S>
Sourcepub unsafe fn uninitialized(
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
layout: MatrixLayout,
) -> Self
pub unsafe fn uninitialized( ident: MatrixIdent, m: usize, n: usize, k: usize, layout: MatrixLayout, ) -> Self
Create a new uninitialized matrix that is going to be used in the matrix-multiply and accumulate function.
§Safety
Must be initialized with load or fill before use. Using it without initialization is
undefined behaviour on CUDA, and completely invalid on Vulkan.
You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.
- MatrixIdent::A Shape => (M, K)
MatrixIdent::BShape => (K, N)MatrixIdent::AccumulatorShape => (M, N)
Not all shapes are supported, and the permitted shapes depend on the element type.
Refer to nvidia documentation.
Sourcepub fn from_value(
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
layout: MatrixLayout,
value: C,
) -> Selfwhere
C: Scalar,
pub fn from_value(
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
layout: MatrixLayout,
value: C,
) -> Selfwhere
C: Scalar,
Create a new matrix that is going to be used in the
matrix-multiply and accumulate function and is filled with value.
You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.
- MatrixIdent::A Shape => (M, K)
MatrixIdent::BShape => (K, N)MatrixIdent::AccumulatorShape => (M, N)
Not all shapes are supported, and the permitted shapes depend on the element type.
Refer to nvidia documentation.
Sourcepub fn from_slice(
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
layout: MatrixLayout,
value: &[C],
stride: u32,
) -> Self
pub fn from_slice( ident: MatrixIdent, m: usize, n: usize, k: usize, layout: MatrixLayout, value: &[C], stride: u32, ) -> Self
Create a new matrix that is going to be used in the
matrix-multiply and accumulate function and is loaded from value with stride.
You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.
- MatrixIdent::A Shape => (M, K)
MatrixIdent::BShape => (K, N)MatrixIdent::AccumulatorShape => (M, N)
Not all shapes are supported, and the permitted shapes depend on the element type.
Refer to nvidia documentation.
Sourcepub fn from_tensor(
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
value: &TensorView<C>,
) -> Self
pub fn from_tensor( ident: MatrixIdent, m: usize, n: usize, k: usize, value: &TensorView<C>, ) -> Self
Create a new matrix that is going to be used in the
matrix-multiply and accumulate function and is loaded from value with stride.
You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.
- MatrixIdent::A Shape => (M, K)
MatrixIdent::BShape => (K, N)MatrixIdent::AccumulatorShape => (M, N)
Not all shapes are supported, and the permitted shapes depend on the element type.
Refer to nvidia documentation.
Sourcepub fn __expand_uninitialized(
scope: &Scope,
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
layout: <MatrixLayout as CubeType>::ExpandType,
) -> <Self as CubeType>::ExpandType
pub fn __expand_uninitialized( scope: &Scope, ident: MatrixIdent, m: usize, n: usize, k: usize, layout: <MatrixLayout as CubeType>::ExpandType, ) -> <Self as CubeType>::ExpandType
Create a new uninitialized matrix that is going to be used in the matrix-multiply and accumulate function.
§Safety
Must be initialized with load or fill before use. Using it without initialization is
undefined behaviour on CUDA, and completely invalid on Vulkan.
You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.
- MatrixIdent::A Shape => (M, K)
MatrixIdent::BShape => (K, N)MatrixIdent::AccumulatorShape => (M, N)
Not all shapes are supported, and the permitted shapes depend on the element type.
Refer to nvidia documentation.
Sourcepub fn __expand_from_value(
scope: &Scope,
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
layout: <MatrixLayout as CubeType>::ExpandType,
value: <C as CubeType>::ExpandType,
) -> <Self as CubeType>::ExpandTypewhere
C: Scalar,
pub fn __expand_from_value(
scope: &Scope,
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
layout: <MatrixLayout as CubeType>::ExpandType,
value: <C as CubeType>::ExpandType,
) -> <Self as CubeType>::ExpandTypewhere
C: Scalar,
Create a new matrix that is going to be used in the
matrix-multiply and accumulate function and is filled with value.
You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.
- MatrixIdent::A Shape => (M, K)
MatrixIdent::BShape => (K, N)MatrixIdent::AccumulatorShape => (M, N)
Not all shapes are supported, and the permitted shapes depend on the element type.
Refer to nvidia documentation.
Sourcepub fn __expand_from_slice(
scope: &Scope,
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
layout: <MatrixLayout as CubeType>::ExpandType,
value: &<[C] as CubeType>::ExpandType,
stride: <u32 as CubeType>::ExpandType,
) -> <Self as CubeType>::ExpandType
pub fn __expand_from_slice( scope: &Scope, ident: MatrixIdent, m: usize, n: usize, k: usize, layout: <MatrixLayout as CubeType>::ExpandType, value: &<[C] as CubeType>::ExpandType, stride: <u32 as CubeType>::ExpandType, ) -> <Self as CubeType>::ExpandType
Create a new matrix that is going to be used in the
matrix-multiply and accumulate function and is loaded from value with stride.
You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.
- MatrixIdent::A Shape => (M, K)
MatrixIdent::BShape => (K, N)MatrixIdent::AccumulatorShape => (M, N)
Not all shapes are supported, and the permitted shapes depend on the element type.
Refer to nvidia documentation.
Sourcepub fn __expand_from_tensor(
scope: &Scope,
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
value: &<TensorView<C> as CubeType>::ExpandType,
) -> <Self as CubeType>::ExpandType
pub fn __expand_from_tensor( scope: &Scope, ident: MatrixIdent, m: usize, n: usize, k: usize, value: &<TensorView<C> as CubeType>::ExpandType, ) -> <Self as CubeType>::ExpandType
Create a new matrix that is going to be used in the
matrix-multiply and accumulate function and is loaded from value with stride.
You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.
- MatrixIdent::A Shape => (M, K)
MatrixIdent::BShape => (K, N)MatrixIdent::AccumulatorShape => (M, N)
Not all shapes are supported, and the permitted shapes depend on the element type.
Refer to nvidia documentation.
Trait Implementations§
impl<C: Copy + CubeType, S: Copy + MatrixScope> Copy for Matrix<C, S>
Source§impl<C: CubeType, S: MatrixScope> CubeType for Matrix<C, S>
impl<C: CubeType, S: MatrixScope> CubeType for Matrix<C, S>
type ExpandType = MatrixExpand<C, S>
Auto Trait Implementations§
impl<C, S> Freeze for Matrix<C, S>
impl<C, S> RefUnwindSafe for Matrix<C, S>where
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<C, S> Send for Matrix<C, S>
impl<C, S> Sync for Matrix<C, S>
impl<C, S> Unpin for Matrix<C, S>
impl<C, S> UnsafeUnpin for Matrix<C, S>
impl<C, S> UnwindSafe for Matrix<C, S>where
C: UnwindSafe,
S: 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