pub struct Matrix<C>where
C: CubeType,{ /* 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> Matrix<C>where
C: CubePrimitive,
impl<C> Matrix<C>where
C: CubePrimitive,
Sourcepub unsafe fn uninitialized(
ident: MatrixIdent,
m: u32,
n: u32,
k: u32,
layout: MatrixLayout,
) -> Matrix<C>
pub unsafe fn uninitialized( ident: MatrixIdent, m: u32, n: u32, k: u32, layout: MatrixLayout, ) -> Matrix<C>
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::B Shape => (K, N)
- MatrixIdent::Accumulator Shape => (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: u32,
n: u32,
k: u32,
layout: MatrixLayout,
value: C,
) -> Matrix<C>
pub fn from_value( ident: MatrixIdent, m: u32, n: u32, k: u32, layout: MatrixLayout, value: C, ) -> Matrix<C>
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::B Shape => (K, N)
- MatrixIdent::Accumulator Shape => (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: u32,
n: u32,
k: u32,
layout: MatrixLayout,
value: &Slice<C>,
stride: u32,
) -> Matrix<C>
pub fn from_slice( ident: MatrixIdent, m: u32, n: u32, k: u32, layout: MatrixLayout, value: &Slice<C>, stride: u32, ) -> Matrix<C>
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::B Shape => (K, N)
- MatrixIdent::Accumulator Shape => (M, N)
Not all shapes are supported, and the permitted shapes depend on the element type.
Refer to nvidia documentation.