You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2023/01/09 16:20:50 UTC
[GitHub] [tvm] ekalda commented on a diff in pull request #13732: [microNPU] Add support for TFLite PAD
ekalda commented on code in PR #13732:
URL: https://github.com/apache/tvm/pull/13732#discussion_r1064825326
##########
python/tvm/relay/backend/contrib/ethosu/legalize.py:
##########
@@ -1355,6 +1355,62 @@ def callback(self, pre, post, node_map):
return ethosu_fc
+class PadRewriter(DFPatternCallback):
+ """Convert ethos-u.pad2d composite function to ethosu_depthwise_conv2d
+ operator"""
+
+ def __init__(self):
+ super().__init__(require_type=True)
+ self.pattern = (
+ wildcard().has_attr({"Composite": ethosu_patterns.PadParams.composite_name})
+ )(wildcard())
+
+ def callback(
+ self, pre: tvm.relay.Expr, post: tvm.relay.Expr, node_map: tvm.ir.container.Map
+ ) -> tvm.relay.Expr:
+ params = ethosu_patterns.PadParams(post.op.body)
+ params.ifm.tensor = post.args[0]
+ channels_map = {
+ "NHWC": 3,
+ }
Review Comment:
IIRC this one entry `channels_map` is a historic relic that can go and so simplify the code little bit, but as it is present in other operators, it's probably a clean up task for some other time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org