Skip to content

Commit 2426951

Browse files
authored
Fix HiFi conv2d_nhwc operator for depthwise case (again)
Differential Revision: D98634082 Pull Request resolved: #18559
1 parent dd9a053 commit 2426951

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

backends/cadence/hifi/operators/op_quantized_conv2d_nhwc_out.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void xa_opt_quantized_conv2d_nhwc(
300300
return;
301301
}
302302

303-
if (groups == input_channels) {
303+
if (is_depthwise) {
304304
WORD32 channels_multiplier = out_channels / input_channels;
305305

306306
scratch_size = xa_nn_conv2d_depthwise_getsize(
@@ -359,6 +359,26 @@ void xa_opt_quantized_conv2d_nhwc(
359359
return;
360360
}
361361
}
362+
363+
// Fallback to generic grouped conv for cases not handled by nnlib
364+
// (e.g. grouped conv with 4D weight where is_depthwise is false)
365+
::impl::generic::native::quantized_conv2d_nhwc_per_tensor_out(
366+
ctx,
367+
input,
368+
weight,
369+
bias,
370+
stride,
371+
padding,
372+
dilation,
373+
groups,
374+
in_zero_point,
375+
weight_zero_point,
376+
bias_scale,
377+
output_scale,
378+
output_zero_point,
379+
0, // out_multiplier (unused)
380+
0, // out_shift (unused)
381+
out);
362382
}
363383

364384
void quantized_conv2d_nhwc(

0 commit comments

Comments
 (0)