mbrookhart commented on a change in pull request #8309:
URL: https://github.com/apache/tvm/pull/8309#discussion_r657470110
##########
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:
The Layout constructor `ICHECK`'s a few conditions, and I think that
throws under the hood? I'm not sure if this will catch it or not. If it doesn't
catch it, this is the same as the current behavior. if this try would catch the
ICHECK, we might end up having a crash here were before things pass an
undefined layout and handled that on the other end? I haven't fully traced the
code that calls this yet.
--
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]