pub enum QuantizationArguments<'a> {
ScaleZeroPointDataType {
scale: f64,
zero_point: i64,
data_type: DataType,
},
ScaleTensorZeroPointDataTypeAxis {
scale_tensor: &'a Tensor,
zero_point: f64,
data_type: DataType,
axis: i64,
},
ScaleTensorZeroPointTensorDataTypeAxis {
scale_tensor: &'a Tensor,
zero_point_tensor: &'a Tensor,
data_type: DataType,
axis: i64,
},
}Expand description
Arguments controlling how a floating-point tensor is quantized into an integer representation.
All variants follow the same conceptual formula but differ in whether the scale and zero-point are provided as scalars or tensors and whether the scaling is applied per-axis.
Variants§
ScaleZeroPointDataType
Fields
ScaleTensorZeroPointDataTypeAxis
Quantize using a per-axis scale_tensor and scalar zero_point.
§Details
Formula: result = (tensor / scale_tensor) + zero_point.
Fields
ScaleTensorZeroPointTensorDataTypeAxis
Quantize using per-axis scale_tensor and zero_point_tensor.
§Details
Formula: result = (tensor / scale_tensor) + zero_point_tensor.
Fields
Auto Trait Implementations§
impl<'a> Freeze for QuantizationArguments<'a>
impl<'a> !RefUnwindSafe for QuantizationArguments<'a>
impl<'a> !Send for QuantizationArguments<'a>
impl<'a> !Sync for QuantizationArguments<'a>
impl<'a> Unpin for QuantizationArguments<'a>
impl<'a> !UnwindSafe for QuantizationArguments<'a>
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