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


Reply via email to