pub struct BlockQuantizedMatrix<'a, T> { /* private fields */ }Expand description
Matrix which is quantized into blocks along the K dimension.
The data layout and supported bit/block sizes follow ONNX Runtime’s MatMulNBits operator. See https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md.
Implementations§
Source§impl<'a, T: Copy> BlockQuantizedMatrix<'a, T>
impl<'a, T: Copy> BlockQuantizedMatrix<'a, T>
Sourcepub const MIN_BLOCK_SIZE: usize = 16
pub const MIN_BLOCK_SIZE: usize = 16
Minimum supported number of elements per block.
Sourcepub fn new(
quant: Contiguous<NdTensorView<'a, u8, 3>>,
scales: Contiguous<NdTensorView<'a, T, 2>>,
bits: u8,
) -> Result<Self, BlockQuantizedError>
pub fn new( quant: Contiguous<NdTensorView<'a, u8, 3>>, scales: Contiguous<NdTensorView<'a, T, 2>>, bits: u8, ) -> Result<Self, BlockQuantizedError>
Create a block-quantized RHS matrix input.
quant is the block-quantized input with shape (cols, k_blocks,
block_size). scales are the per-block scales with shape (cols,
k_blocks). bits specifies the number of bits per element in each
block.
The number of elements per quantized block must be a power of 2 of at
least MIN_BLOCK_SIZE.
Trait Implementations§
Source§impl<'a, T: Clone> Clone for BlockQuantizedMatrix<'a, T>
impl<'a, T: Clone> Clone for BlockQuantizedMatrix<'a, T>
Source§fn clone(&self) -> BlockQuantizedMatrix<'a, T>
fn clone(&self) -> BlockQuantizedMatrix<'a, T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a, T: Copy> Copy for BlockQuantizedMatrix<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for BlockQuantizedMatrix<'a, T>
impl<'a, T> RefUnwindSafe for BlockQuantizedMatrix<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for BlockQuantizedMatrix<'a, T>
impl<'a, T> Sync for BlockQuantizedMatrix<'a, T>
impl<'a, T> Unpin for BlockQuantizedMatrix<'a, T>
impl<'a, T> UnsafeUnpin for BlockQuantizedMatrix<'a, T>
impl<'a, T> UnwindSafe for BlockQuantizedMatrix<'a, T>where
T: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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