tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] Menooker commented on a change in pull request #5357: [Relay] enable blocking format in x86 conv2d and fold scale axis
Date Sun, 26 Apr 2020 03:40:48 GMT

Menooker commented on a change in pull request #5357:
URL: https://github.com/apache/incubator-tvm/pull/5357#discussion_r415204685



##########
File path: src/relay/transforms/fold_scale_axis.cc
##########
@@ -518,13 +564,30 @@ Expr Conv2DForwardRewrite(const Call& ref_call,
 
   // match the ic_axis
   if (is_depthwise_conv2d) {
-    Expr scale = ExpandBiasToMatchAxis(
-        sdata->scale, kernel_layout.ndim(), {big_oc_axis});
-    weight = Multiply(weight, scale);
+    if (is_simple) {
+      Expr scale = ExpandBiasToMatchAxis(
+          sdata->scale, kernel_layout.ndim(), {big_ko_axis});
+      weight = Multiply(weight, scale);
+    } else {
+      weight = Multiply(weight, ReshapeToMatchAxis(sdata->scale,
+          weight->type_as<TensorTypeNode>()->shape,
+          {big_ko_axis, small_ko_axis}));
+      if (!weight.defined())
+        return Expr();

Review comment:
       I can see in line 542 and 543 in the same function:
   ```
    if (sdata == nullptr) return Expr();
    if (sweight != nullptr) return Expr();
   ```
   
   Looks like returning `Expr()` just mean that the optimization fails?




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



Mime
View raw message