This is an automated email from the ASF dual-hosted git repository.
haichen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git
The following commit(s) were added to refs/heads/master by this push:
new 7e9ec73 improve antlr import error message (#4888)
7e9ec73 is described below
commit 7e9ec7352d487fddb0be25f4b53cce3abfad71c9
Author: masahi <[email protected]>
AuthorDate: Sun Feb 16 03:32:58 2020 +0900
improve antlr import error message (#4888)
---
python/tvm/relay/_parser.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/python/tvm/relay/_parser.py b/python/tvm/relay/_parser.py
index 78ab8ff..49bdbb3 100644
--- a/python/tvm/relay/_parser.py
+++ b/python/tvm/relay/_parser.py
@@ -48,13 +48,6 @@ from . import op
PYTHON_VERSION = sys.version_info.major
try:
- from .grammar.py3.RelayVisitor import RelayVisitor
- from .grammar.py3.RelayParser import RelayParser
- from .grammar.py3.RelayLexer import RelayLexer
-except ImportError:
- raise Exception("Couldn't find ANTLR parser. Try building with
USE_ANTLR=ON.")
-
-try:
from antlr4 import InputStream, CommonTokenStream
from antlr4.error.ErrorListener import ErrorListener
except ImportError:
@@ -62,6 +55,14 @@ except ImportError:
"Try running `pip{version} install
antlr4-python{version}-runtime`."
.format(version=PYTHON_VERSION))
+try:
+ from .grammar.py3.RelayVisitor import RelayVisitor
+ from .grammar.py3.RelayParser import RelayParser
+ from .grammar.py3.RelayLexer import RelayLexer
+except ImportError:
+ raise Exception("Couldn't find ANTLR parser. Try building with
USE_ANTLR=ON.")
+
+
sys.setrecursionlimit(10000)
class ParseError(Exception):