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/12/02 01:02:48 UTC

[GitHub] [tvm] shingjan commented on a change in pull request #9620: [TVMScript] Add for loop syntax sugar

shingjan commented on a change in pull request #9620:
URL: https://github.com/apache/tvm/pull/9620#discussion_r760686863



##########
File path: python/tvm/script/parser.py
##########
@@ -272,6 +272,13 @@ def parse_arg_list(self, func, node_call):
                 f"but it is {type(func).__name__}",
                 node_call.span,
             )
+
+        # for loop syntax sugar, check if starting 0 is omitted
+        # param_list[0] is the list of positional args which could include kw_args
+        # therefore the sum of len(args) and len(kw_args) is used here
+        if isinstance(func, ForScopeHandler) and len(args) + len(kw_args) < len(param_list[0]):
+            if args[0] != 0:
+                args.insert(0, 0)

Review comment:
       done




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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org