tqchen commented on code in PR #13934:
URL: https://github.com/apache/tvm/pull/13934#discussion_r1143777943
##########
python/tvm/runtime/script_printer.py:
##########
@@ -65,38 +69,49 @@ def __init__(
) -> None:
if num_context_lines is None:
num_context_lines = -1
+ cfg = {
+ "show_meta": show_meta,
+ "ir_prefix": ir_prefix,
+ "tir_prefix": tir_prefix,
+ "relax_prefix": relax_prefix,
+ "buffer_dtype": buffer_dtype,
+ "int_dtype": int_dtype,
+ "float_dtype": float_dtype,
+ "verbose_expr": verbose_expr,
+ "indent_spaces": indent_spaces,
+ "print_line_numbers": print_line_numbers,
+ "num_context_lines": num_context_lines,
+ "syntax_sugar": syntax_sugar,
+ "path_to_underline": path_to_underline,
+ "path_to_annotate": path_to_annotate,
+ "obj_to_underline": obj_to_underline,
+ "obj_to_annotate": obj_to_annotate,
+ }
+
+ if name is not None:
+ cfg["name"] = name
self.__init_handle_by_constructor__(
- _ffi_node_api.PrinterConfig, # type: ignore # pylint:
disable=no-member
- {
- "ir_prefix": ir_prefix,
- "tir_prefix": tir_prefix,
- "relax_prefix": relax_prefix,
- "buffer_dtype": buffer_dtype,
- "int_dtype": int_dtype,
- "float_dtype": float_dtype,
- "verbose_expr": verbose_expr,
- "indent_spaces": indent_spaces,
- "print_line_numbers": print_line_numbers,
- "num_context_lines": num_context_lines,
- "syntax_sugar": syntax_sugar,
- "path_to_underline": path_to_underline,
- "path_to_annotate": path_to_annotate,
- "obj_to_underline": obj_to_underline,
- "obj_to_annotate": obj_to_annotate,
- },
+ _ffi_node_api.PrinterConfig, cfg # type: ignore # pylint:
disable=no-member
)
def _script(obj: Object, config: PrinterConfig) -> str:
return _ffi_node_api.TVMScriptPrinterScript(obj, config) # type: ignore #
pylint: disable=no-member
+def _relax_script(obj: Object, config: PrinterConfig) -> str:
+ func = get_global_func("script.printer.ReprPrintRelax")
+ return func(obj, config)
+
+
Review Comment:
In this case, I don;t think there is any issue future proofing the
particular implementation. Given that non of the existing works are disrupted.
Ultimately i would lean more towards the maintainer of the modules, given
they volunteered their time and effort building the module in a scoped way. So
unless this s disrupting some of the existing modules, i would suggest let the
maintainers make the call
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]