Skip to content

Commit a042c1e

Browse files
cccxinliShiboXing
authored andcommitted
[Fix] Fix the wrong check for tuple node in apache#18163 (apache#18170)
* [Fix] Fix the wrong check for tuple node in apache#18163
1 parent 63d6740 commit a042c1e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/relax/transform/fuse_ops.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,17 +427,18 @@ class FunctionCreator : public ExprMutator {
427427
}
428428

429429
for (const Expr& arg : call->args) {
430-
if (GetStructInfoAs<TupleStructInfoNode>(arg) != nullptr) {
431-
// The argument is fully referenced. Thus we remove it from the mapping.
432-
partially_used_tuple_params_.erase(arg.get());
433-
const Tuple& tup_args = Downcast<Tuple>(arg);
434-
for (const Expr& tup_arg : tup_args->fields) {
430+
if (auto tuple = arg.as<TupleNode>()) {
431+
for (const Expr& tup_arg : tuple->fields) {
435432
CheckDefAndUpdateParam(tup_arg);
436433
ICHECK(GetStructInfoAs<TupleStructInfoNode>(tup_arg) == nullptr);
437434
}
438435
} else {
439436
CheckDefAndUpdateParam(arg);
440437
}
438+
if (GetStructInfoAs<TupleStructInfoNode>(arg) != nullptr) {
439+
// The argument is fully referenced. Thus we remove it from the mapping.
440+
partially_used_tuple_params_.erase(arg.get());
441+
}
441442
}
442443
}
443444
} else if (var_binding->value.as<TupleGetItemNode>()) {

0 commit comments

Comments
 (0)