merrymercy commented on a change in pull request #7161:
URL: https://github.com/apache/tvm/pull/7161#discussion_r548457440



##########
File path: src/auto_scheduler/compute_dag.cc
##########
@@ -1452,5 +1453,29 @@ 
TVM_REGISTER_GLOBAL("auto_scheduler.RewriteIndexForNewLayout")
       return index_rewriter.Rewrite(body);
     });
 
+TVM_REGISTER_GLOBAL("auto_scheduler.GetShapeFromRewrittenLayout")
+    .set_body_typed([](String rewritten_layout, Array<String> axis_names) {
+      Array<PrimExpr> shape;
+      std::vector<std::string> extracted_names;
+      topi::parse_auto_scheduler_layout(rewritten_layout, &shape, 
&extracted_names);
+
+      Array<PrimExpr> ret(axis_names.size(), 1);
+
+      for (size_t i = 0; i < axis_names.size(); ++i) {
+        bool found = false;
+        for (size_t j = 0; j < extracted_names.size(); ++j) {
+          if (axis_names[i] == extracted_names[j]) {
+            ret.Set(i, ret[i] * shape[j]);
+            found = true;

Review comment:
       We should not break here. The axis appears multiple times and we compute 
the accumulated product.




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