You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ju...@apache.org on 2022/12/17 02:04:02 UTC

[tvm] branch main updated: [Relay][Testing][Bugfix] `py_converter` should use correct AST for versions above 3.8 too (#13635)

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

junrushao 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 e3afc92818 [Relay][Testing][Bugfix] `py_converter` should use correct AST for versions above 3.8 too (#13635)
e3afc92818 is described below

commit e3afc92818eab07fe3db2960294eaebcf1f765bc
Author: Steven S. Lyubomirsky <sl...@octoml.ai>
AuthorDate: Fri Dec 16 21:03:55 2022 -0500

    [Relay][Testing][Bugfix] `py_converter` should use correct AST for versions above 3.8 too (#13635)
    
    Currently, `relay.testing.py_converter` is checking for using _exactly_ Python 3.8 in order to use certain updated signatures in the `ast` library. However, those signatures are also correct for versions _above_ 3.8. This PR changes the bounds checks so that the converter will work above 3.8.
---
 python/tvm/relay/testing/py_converter.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/tvm/relay/testing/py_converter.py b/python/tvm/relay/testing/py_converter.py
index 50f473aea1..1ec85faea6 100644
--- a/python/tvm/relay/testing/py_converter.py
+++ b/python/tvm/relay/testing/py_converter.py
@@ -88,7 +88,7 @@ class PythonConverter(ExprFunctor):
         body.append(Assign([Name(OUTPUT_VAR_NAME, Store())], prog_body))
         global __MAJOR__, __MINOR__
 
-        if __MAJOR__ == 3 and __MINOR__ == 8:
+        if __MAJOR__ == 3 and __MINOR__ >= 8:
             return ast.fix_missing_locations(ast.Module(body=body, type_ignores=[]))
         else:
             return ast.fix_missing_locations(ast.Module(body=body))
@@ -224,7 +224,7 @@ class PythonConverter(ExprFunctor):
         inner_args = [ast.arg(argument, None) for argument in arguments]
 
         global __MAJOR__, __MINOR__
-        if __MAJOR__ == 3 and __MINOR__ == 8:
+        if __MAJOR__ == 3 and __MINOR__ >= 8:
             arguments = ast.arguments([], inner_args, None, [], [], None, [])
         else:
             arguments = ast.arguments(inner_args, None, [], [], None, [])