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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to