pub struct QuantizedLinear<B: Backend> { /* private fields */ }Expand description
y = x @ W^T (+ b) where W is stored group-quantized to 4 bits.
Implementations§
Source§impl<B: Backend> QuantizedLinear<B>
impl<B: Backend> QuantizedLinear<B>
Sourcepub fn new(
packed: Tensor<B, 2, Int>,
scales: Tensor<B, 2>,
group_size: usize,
bias: Option<Tensor<B, 1>>,
) -> Result<Self>
pub fn new( packed: Tensor<B, 2, Int>, scales: Tensor<B, 2>, group_size: usize, bias: Option<Tensor<B, 1>>, ) -> Result<Self>
Builds a layer from on-device packed parts, validating shapes.
Sourcepub fn in_features(&self) -> usize
pub fn in_features(&self) -> usize
Input feature count (dequantized in_features).
Sourcepub fn out_features(&self) -> usize
pub fn out_features(&self) -> usize
Output feature count.
Auto Trait Implementations§
impl<B> Freeze for QuantizedLinear<B>where
<B as BackendTypes>::IntTensorPrimitive: Freeze,
<B as BackendTypes>::FloatTensorPrimitive: Freeze,
<B as BackendTypes>::QuantizedTensorPrimitive: Freeze,
impl<B> RefUnwindSafe for QuantizedLinear<B>where
<B as BackendTypes>::IntTensorPrimitive: RefUnwindSafe,
<B as BackendTypes>::FloatTensorPrimitive: RefUnwindSafe,
<B as BackendTypes>::QuantizedTensorPrimitive: RefUnwindSafe,
impl<B> Send for QuantizedLinear<B>
impl<B> Sync for QuantizedLinear<B>
impl<B> Unpin for QuantizedLinear<B>where
<B as BackendTypes>::IntTensorPrimitive: Unpin,
<B as BackendTypes>::FloatTensorPrimitive: Unpin,
<B as BackendTypes>::QuantizedTensorPrimitive: Unpin,
impl<B> UnsafeUnpin for QuantizedLinear<B>where
<B as BackendTypes>::IntTensorPrimitive: UnsafeUnpin,
<B as BackendTypes>::FloatTensorPrimitive: UnsafeUnpin,
<B as BackendTypes>::QuantizedTensorPrimitive: UnsafeUnpin,
impl<B> UnwindSafe for QuantizedLinear<B>where
<B as BackendTypes>::IntTensorPrimitive: UnwindSafe,
<B as BackendTypes>::FloatTensorPrimitive: UnwindSafe,
<B as BackendTypes>::QuantizedTensorPrimitive: 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
Mutably borrows from an owned value. Read more