pub struct QDepthwiseConv2D<'a, const C: usize, const KH: usize, const KW: usize, const SH: usize = 1, const SW: usize = 1, const PT: usize = 0, const PB: usize = 0, const PL: usize = 0, const PR: usize = 0> {
pub weights: &'a [[[i8; KW]; KH]; C],
pub biases: Option<&'a [i32; C]>,
pub input_zero_point: i8,
pub requantizers: &'a [Requantizer; C],
}Expand description
A quantized depthwise 2D convolution: one KH x KW filter per channel,
channels never mixed, one requantizer per channel as TFLite requires (C++
QDepthwiseConv2D).
Weights are weights[channel][row][column]; strides and padding as in
QConv2D. The output has the input’s C channels.
Fields§
§weights: &'a [[[i8; KW]; KH]; C]weights[c][kh][kw].
biases: Option<&'a [i32; C]>One i32 bias per channel, or None.
input_zero_point: i8The input tensor’s zero point, which also fills the padding.
requantizers: &'a [Requantizer; C]requantizers[c] rescales channel c.
Implementations§
Source§impl<const C: usize, const KH: usize, const KW: usize, const SH: usize, const SW: usize, const PT: usize, const PB: usize, const PL: usize, const PR: usize> QDepthwiseConv2D<'_, C, KH, KW, SH, SW, PT, PB, PL, PR>
impl<const C: usize, const KH: usize, const KW: usize, const SH: usize, const SW: usize, const PT: usize, const PB: usize, const PL: usize, const PR: usize> QDepthwiseConv2D<'_, C, KH, KW, SH, SW, PT, PB, PL, PR>
Sourcepub fn forward<const H: usize, const W: usize, const OH: usize, const OW: usize>(
&self,
input: &[[[i8; C]; W]; H],
output: &mut [[[i8; C]; OW]; OH],
)
pub fn forward<const H: usize, const W: usize, const OH: usize, const OW: usize>( &self, input: &[[[i8; C]; W]; H], output: &mut [[[i8; C]; OW]; OH], )
One forward pass over an H x W x C input into an OH x OW x
C output; OH and OW as in QConv2D::forward.
Channel by channel, as tinymind (C++) runs it: each channel’s taps, its
bias folded with the zero point (bias - zp * sum w) and its prepared
requantizer stay put across the pixels. The i32 sums are the same
integers as the per-tap form, modulo 2^32.