Skip to content

Commit

Permalink
[microNPU] Enforce bias when pattern matching conv2d (apache#9244)
Browse files Browse the repository at this point in the history
Currently a conv2d pattern is matched when no bias is present.
However, legalization expects a bias to be present, therefore
causing an error when this is not the case. For now, enforce a
bias when offloading conv2d to the NPU.

Change-Id: I7f74b0f2c151f51ddc66ee1c5ebb77534238909b
  • Loading branch information
lhutton1 authored and ylc committed Jan 13, 2022
1 parent 345c9b9 commit aedbaf3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/tvm/relay/op/contrib/ethosu.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def qnn_conv2d_pattern() -> tvm.relay.dataflow_pattern.DFPattern:
).has_attr({"kernel_layout": "HWIO"})
bias_add = is_op("nn.bias_add")(qnn_conv2d, is_constant())
req = is_op("qnn.requantize")(
qnn_conv2d | bias_add, is_constant(), is_constant(), is_constant(), is_constant()
bias_add, is_constant(), is_constant(), is_constant(), is_constant()
)
clip_or_req = req.optional(is_op("clip"))
return clip_or_req
Expand Down

0 comments on commit aedbaf3

Please sign in to comment.