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/06/23 20:27:50 UTC

[GitHub] [tvm] masahi commented on a change in pull request #8309: [Relay] Remove in-place modification of attributes in layout transform

masahi commented on a change in pull request #8309:
URL: https://github.com/apache/tvm/pull/8309#discussion_r657437849



##########
File path: src/relay/op/tensor/transform.cc
##########
@@ -477,19 +477,16 @@ Array<Array<Layout>> TransposeInferCorrectLayout(const Attrs& attrs,
   }
 
   // Infer the output layout string based on the input layout and the axes.
+  Attrs new_attrs(params);
   if (in_layout_str != "") {
     for (auto axis : params->axes) {
       ICHECK_LT(axis->value, in_layout_str.length());
       out_layout_str += in_layout_str[axis->value];
     }
-    try {
-      return Array<Array<Layout>>({{Layout(in_layout_str)}, {Layout(out_layout_str)}});
-    } catch (const tvm::Error& e) {
-      // If the layout string is invalid for any reason, give up.

Review comment:
       I didn't get what this try/catch is supposed to do, since `return Array<Array<Layout>>({{Layout(in_layout_str)}, {Layout(out_layout_str)}});` never throws. I think it's safe to remove it.




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