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 2021/03/12 10:54:43 UTC

[GitHub] [tvm] NicolaLancellotti commented on a change in pull request #7556: Remove pytest dependency in arm_compute_lib.py

NicolaLancellotti commented on a change in pull request #7556:
URL: https://github.com/apache/tvm/pull/7556#discussion_r593084365



##########
File path: python/tvm/relay/op/contrib/arm_compute_lib.py
##########
@@ -111,20 +111,38 @@ def convert_conv(attrs, inputs, tinfos, desired_layouts):
 
         return convert_conv
 
-    with TempOpAttr(
-        "nn.conv2d", "FTVMConvertOpLayout", convert_layout_conv2d(tvm.relay.nn.conv2d)
-    ), TempOpAttr(
-        "qnn.conv2d", "FTVMConvertOpLayout", convert_layout_conv2d(tvm.relay.qnn.op.conv2d)
-    ):
-        seq = tvm.transform.Sequential(
-            [
-                transform.ConvertLayout(
-                    {"nn.conv2d": ["NHWC", "OHWI"], "qnn.conv2d": ["NHWC", "OHWI"]}
-                ),
-                transform.FoldConstant(),
-            ]
-        )
-        preprocessed_mod = seq(mod)
+    # Set tmp attributes
+    attr_key = "FTVMConvertOpLayout"
+
+    op_nn = relay.op.get("nn.conv2d")
+    older_attr_nn = op_nn.get_attr(attr_key)
+    op_nn.reset_attr(attr_key)
+    op_nn.set_attr(attr_key, convert_layout_conv2d(tvm.relay.nn.conv2d))
+
+    op_qnn = relay.op.get("qnn.conv2d")
+    older_attr_qnn = op_qnn.get_attr(attr_key)
+    op_qnn.reset_attr(attr_key)
+    op_qnn.set_attr(attr_key, convert_layout_conv2d(tvm.relay.qnn.op.conv2d))

Review comment:
       I have added `OpAttrContext` (which is a copy of `TempOpAttr`) in `arm_compute_lib.py`.
   And I have replaced `TempOpAttr` with `OpAttrContext`.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org