pub struct Matrix<C, S = Plane>where
C: CubeType,
S: MatrixScope,{ /* 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, S> Matrix<C, S>where
C: CubePrimitive,
S: MatrixScope,
impl<C, S> Matrix<C, S>where
C: CubePrimitive,
S: MatrixScope,
Sourcepub unsafe fn uninitialized(
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
layout: MatrixLayout,
) -> Matrix<C, S>
pub unsafe fn uninitialized( ident: MatrixIdent, m: usize, n: usize, k: usize, layout: MatrixLayout, ) -> Matrix<C, S>
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,
) -> Matrix<C, S>where
C: Scalar,
pub fn from_value(
ident: MatrixIdent,
m: usize,
n: usize,
k: usize,
layout: MatrixLayout,
value: C,
) -> Matrix<C, S>where
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,
) -> Matrix<C, S>
pub fn from_slice( ident: MatrixIdent, m: usize, n: usize, k: usize, layout: MatrixLayout, value: &[C], stride: u32, ) -> Matrix<C, S>
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>,
) -> Matrix<C, S>
pub fn from_tensor( ident: MatrixIdent, m: usize, n: usize, k: usize, value: &TensorView<C>, ) -> Matrix<C, S>
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,
) -> <Matrix<C, S> as CubeType>::ExpandType
pub fn __expand_uninitialized( scope: &Scope, ident: MatrixIdent, m: usize, n: usize, k: usize, layout: <MatrixLayout as CubeType>::ExpandType, ) -> <Matrix<C, S> 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,
) -> <Matrix<C, S> 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,
) -> <Matrix<C, S> 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,
) -> <Matrix<C, S> 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, ) -> <Matrix<C, S> 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,
) -> <Matrix<C, S> as CubeType>::ExpandType
pub fn __expand_from_tensor( scope: &Scope, ident: MatrixIdent, m: usize, n: usize, k: usize, value: &<TensorView<C> as CubeType>::ExpandType, ) -> <Matrix<C, S> 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, S> Copy for Matrix<C, S>
Source§impl<C, S> CubeType for Matrix<C, S>where
C: CubeType,
S: MatrixScope,
impl<C, S> CubeType for Matrix<C, S>where
C: CubeType,
S: MatrixScope,
type ExpandType = MatrixExpand<C, S>
Auto Trait Implementations§
impl<C, S> Freeze for Matrix<C, S>
impl<C, S> RefUnwindSafe for Matrix<C, S>
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>
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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