File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
python/tvm/script/parser/core Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 1818import inspect
1919from typing import Any , Dict , Union
2020
21+ import tvm
2122from ....ir .module import IRModule
2223from ...ir_builder import IRBuilder
2324from . import doc
@@ -95,22 +96,19 @@ def parse(
9596 ret = builder .get ()
9697 # check well-formedness in both Relax and TIR
9798 if check_well_formed :
98- # (C0415 = import-outside-toplevel. It is necessary here to avoid a circular dependency,
99- # since importing Relax imports a dependency on the parser)
100- from ....relax .analysis import well_formed as relax_well_formed # pylint: disable=C0415
101- from ....tir .analysis import verify_well_formed as tir_well_formed # pylint: disable=C0415
102-
10399 check_ret = ret
104100 if not isinstance (check_ret , IRModule ):
105101 check_ret = IRModule .from_expr (ret )
106102
107103 source_ast = source .as_ast ()
108104
109- if not relax_well_formed (ret ):
105+ if isinstance (ret , (IRModule , tvm .relax .Function )) and not tvm .relax .analysis .well_formed (
106+ ret
107+ ):
110108 parser .report_error (source_ast , err = WELL_FORMED_ERROR_MESSAGE )
111109
112110 try :
113- tir_well_formed (check_ret )
111+ tvm . tir . analysis . verify_well_formed (check_ret )
114112 except Exception as err : # pylint: disable=broad-exception-caught
115113 parser .report_error (
116114 source_ast ,
You can’t perform that action at this time.
0 commit comments