This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 454012f363 [Fix] Fix the wrong check for tuple node in #18163 (#18170)
454012f363 is described below

commit 454012f363e168c0a85d75192bc2345d521aa4e4
Author: chenxinli <[email protected]>
AuthorDate: Fri Aug 1 20:01:18 2025 +0800

    [Fix] Fix the wrong check for tuple node in #18163 (#18170)
    
    * [Fix] Fix the wrong check for tuple node in #18163
---
 src/relax/transform/fuse_ops.cc | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/relax/transform/fuse_ops.cc b/src/relax/transform/fuse_ops.cc
index 434a7e7653..bfc278b9c7 100644
--- a/src/relax/transform/fuse_ops.cc
+++ b/src/relax/transform/fuse_ops.cc
@@ -427,17 +427,18 @@ class FunctionCreator : public ExprMutator {
           }
 
           for (const Expr& arg : call->args) {
-            if (GetStructInfoAs<TupleStructInfoNode>(arg) != nullptr) {
-              // The argument is fully referenced. Thus we remove it from the 
mapping.
-              partially_used_tuple_params_.erase(arg.get());
-              const Tuple& tup_args = Downcast<Tuple>(arg);
-              for (const Expr& tup_arg : tup_args->fields) {
+            if (auto tuple = arg.as<TupleNode>()) {
+              for (const Expr& tup_arg : tuple->fields) {
                 CheckDefAndUpdateParam(tup_arg);
                 ICHECK(GetStructInfoAs<TupleStructInfoNode>(tup_arg) == 
nullptr);
               }
             } else {
               CheckDefAndUpdateParam(arg);
             }
+            if (GetStructInfoAs<TupleStructInfoNode>(arg) != nullptr) {
+              // The argument is fully referenced. Thus we remove it from the 
mapping.
+              partially_used_tuple_params_.erase(arg.get());
+            }
           }
         }
       } else if (var_binding->value.as<TupleGetItemNode>()) {

Reply via email to