pub struct QuantizedConv2d { /* private fields */ }Expand description
Quantized 2D Convolution Layer
Stores weights in INT8 format with per-channel scales. Performs computation in INT32 accumulator, then dequantizes to FP32.
Implementations§
Source§impl QuantizedConv2d
impl QuantizedConv2d
Sourcepub fn from_fp32(conv: &Conv2d, input_scale: f32, input_zero_point: i32) -> Self
pub fn from_fp32(conv: &Conv2d, input_scale: f32, input_zero_point: i32) -> Self
Create from FP32 Conv2d with per-channel weight quantization
§Arguments
conv- FP32 convolution layer to quantizeinput_scale- Expected input activation scaleinput_zero_point- Expected input zero point
Sourcepub fn forward_int8(
&self,
input: &[u8],
input_shape: &[usize],
input_scale: f32,
input_zero_point: u8,
) -> CnnResult<Tensor>
pub fn forward_int8( &self, input: &[u8], input_shape: &[usize], input_scale: f32, input_zero_point: u8, ) -> CnnResult<Tensor>
Sourcepub fn out_channels(&self) -> usize
pub fn out_channels(&self) -> usize
Get number of output channels
Sourcepub fn in_channels(&self) -> usize
pub fn in_channels(&self) -> usize
Get number of input channels
Sourcepub fn kernel_size(&self) -> usize
pub fn kernel_size(&self) -> usize
Get kernel size
Trait Implementations§
Source§impl Clone for QuantizedConv2d
impl Clone for QuantizedConv2d
Source§fn clone(&self) -> QuantizedConv2d
fn clone(&self) -> QuantizedConv2d
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for QuantizedConv2d
impl RefUnwindSafe for QuantizedConv2d
impl Send for QuantizedConv2d
impl Sync for QuantizedConv2d
impl Unpin for QuantizedConv2d
impl UnsafeUnpin for QuantizedConv2d
impl UnwindSafe for QuantizedConv2d
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