pub struct GgufLinear<B: Backend> { /* private fields */ }Expand description
Linear projection backed by a GGUF-sourced quantized tensor.
Internally a DenseLinear<B> (Phase 1B), so the runtime path is the same
as a plain dense weight. The distinct type lets later phases evolve the
representation without changing call sites.
Implementations§
Source§impl<B: Backend> GgufLinear<B>
impl<B: Backend> GgufLinear<B>
Sourcepub fn from_qtensor(qt: &QTensor) -> CandleResult<Self>
pub fn from_qtensor(qt: &QTensor) -> CandleResult<Self>
Build from a candle QTensor previously read out of a GGUF file.
Expects a 2-D weight whose shape is [out_features, in_features]
(the GGUF convention for linear projections — rows are output
neurons). Errors if the rank is wrong or the dequant step fails.
Sourcepub fn from_qtensor_with_bias(
qt: &QTensor,
bias_qt: &QTensor,
) -> CandleResult<Self>
pub fn from_qtensor_with_bias( qt: &QTensor, bias_qt: &QTensor, ) -> CandleResult<Self>
Build with a bias vector. bias_qt must be a 1-D [out_features]
tensor — typical for Qwen2.5 / Bert / any model with attention bias.
Sourcepub fn from_dense_rows(
weight_row_major: &[f32],
out_features: usize,
in_features: usize,
) -> Self
pub fn from_dense_rows( weight_row_major: &[f32], out_features: usize, in_features: usize, ) -> Self
Build directly from already-dequantized fp32 weights. Useful when the caller has already paid the dequant cost (e.g. cached weights, or constructing from synthetic data in tests).
Trait Implementations§
Source§impl<B: Backend> Linear<B> for GgufLinear<B>
impl<B: Backend> Linear<B> for GgufLinear<B>
Auto Trait Implementations§
impl<B> Freeze for GgufLinear<B>
impl<B> RefUnwindSafe for GgufLinear<B>
impl<B> Send for GgufLinear<B>
impl<B> Sync for GgufLinear<B>
impl<B> Unpin for GgufLinear<B>
impl<B> UnsafeUnpin for GgufLinear<B>
impl<B> UnwindSafe for GgufLinear<B>
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<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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