From 7efcf9f698e97b833028fc99801350e1e2e9eff5 Mon Sep 17 00:00:00 2001 From: Luke Hutton Date: Thu, 7 Oct 2021 09:47:39 +0000 Subject: [PATCH] [microNPU] Enforce bias when pattern matching conv2d 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 --- python/tvm/relay/op/contrib/ethosu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tvm/relay/op/contrib/ethosu.py b/python/tvm/relay/op/contrib/ethosu.py index 85ddfd9a7ec8..524ca935795c 100644 --- a/python/tvm/relay/op/contrib/ethosu.py +++ b/python/tvm/relay/op/contrib/ethosu.py @@ -266,7 +266,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