@@ -183,17 +183,16 @@ void xa_opt_quantized_conv2d_nhwc(
183183 // Depthwise is defined by in_channels == groups; depthwise weights have one
184184 // fewer dim than regular weights because the IC dim (always 1) was
185185 // squeezed.
186- bool is_depthwise =
187- !conv1d && input_channels == groups && weight.dim () < input.dim ();
186+ bool is_depthwise = input_channels == groups && weight.dim () < input.dim ();
188187 WORD32 kernel_height;
189188 WORD32 kernel_width;
190189 WORD32 kernel_channels;
191190 WORD32 out_channels;
192191 if (is_depthwise) {
193- // Depthwise weight is [KH, KW, OC]
194- kernel_height = weight.size (0 );
195- kernel_width = weight.size (1 );
196- out_channels = weight.size (2 );
192+ // Depthwise weight: conv2d= [KH, KW, OC], conv1d=[K , OC]
193+ kernel_height = conv1d ? 1 : weight.size (0 );
194+ kernel_width = conv1d ? weight. size ( 0 ) : weight.size (1 );
195+ out_channels = conv1d ? weight. size ( 1 ) : weight.size (2 );
197196 kernel_channels = 1 ;
198197 } else {
199198 // Regular weight is [OC, IC, KH, KW] or for conv1d [OC, K, IC]
@@ -384,14 +383,13 @@ void quantized_conv2d_nhwc(
384383 const int c = conv1d ? input.size (2 ) : input.size (3 );
385384 // Depthwise is defined by in_channels == groups; depthwise weights have one
386385 // fewer dim than regular weights because the IC dim (always 1) was squeezed.
387- const bool is_depthwise =
388- !conv1d && c == groups && weight.dim () < input.dim ();
386+ const bool is_depthwise = c == groups && weight.dim () < input.dim ();
389387 int oc, wh, ww, wc;
390388 if (is_depthwise) {
391- // Depthwise weight is [KH, KW, OC]
392- wh = weight.size (0 );
393- ww = weight.size (1 );
394- oc = weight.size (2 );
389+ // Depthwise weight: conv2d= [KH, KW, OC], conv1d=[K , OC]
390+ wh = conv1d ? 1 : weight.size (0 );
391+ ww = conv1d ? weight. size ( 0 ) : weight.size (1 );
392+ oc = conv1d ? weight. size ( 1 ) : weight.size (2 );
395393 wc = 1 ;
396394 } else {
397395 // Regular weight is [OC, WH, WW, WC] or for conv1d [OC, WW, WC]
0 commit comments