Struct FlexQTensor
pub struct FlexQTensor { /* private fields */ }Expand description
Quantized tensor for the Flex backend.
Stores quantized i8 values in the tensor and keeps scales separately for efficient dequantization without reparsing bytes.
Implementations§
§impl FlexQTensor
impl FlexQTensor
pub fn new(
tensor: FlexTensor,
scheme: QuantScheme,
scales: Vec<f32>,
global: Option<f32>,
) -> FlexQTensor
pub fn new( tensor: FlexTensor, scheme: QuantScheme, scales: Vec<f32>, global: Option<f32>, ) -> FlexQTensor
Create a new quantized tensor.
The tensor must store i8 data and scales must be non-empty. A two-level scheme takes a per-tensor scale, and no other level does.
pub fn tensor(&self) -> &FlexTensor
pub fn tensor(&self) -> &FlexTensor
Get the underlying tensor.
Trait Implementations§
§impl Clone for FlexQTensor
impl Clone for FlexQTensor
§fn clone(&self) -> FlexQTensor
fn clone(&self) -> FlexQTensor
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 more§impl Debug for FlexQTensor
impl Debug for FlexQTensor
§impl TensorMetadata for FlexQTensor
impl TensorMetadata for FlexQTensor
§type Device = FlexDevice
type Device = FlexDevice
The device type associated with the tensor.
§fn device(&self) -> <FlexQTensor as TensorMetadata>::Device
fn device(&self) -> <FlexQTensor as TensorMetadata>::Device
Get the device associated with the tensor.
§fn can_mut(&self) -> bool
fn can_mut(&self) -> bool
Whether the tensor’s buffer can be mutated in place — i.e. this handle
uniquely owns it, so an in-place op (
slice_assign, an inplace kernel)
writes the existing allocation instead of copying it first. Read more§fn scheme(&self) -> QuantScheme
fn scheme(&self) -> QuantScheme
Get the quantization scheme for a quantized float tensor. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for FlexQTensor
impl !UnwindSafe for FlexQTensor
impl Freeze for FlexQTensor
impl Send for FlexQTensor
impl Sync for FlexQTensor
impl Unpin for FlexQTensor
impl UnsafeUnpin for FlexQTensor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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