tqchen commented on code in PR #13934:
URL: https://github.com/apache/tvm/pull/13934#discussion_r1143881456


##########
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:
   it is scoped in a sense that the name itself clearly differentiates itself 
from other functions and won't cause confusion. It is common for code to have 
plugin registries that queries and runs function when available :) Atm there 
does not seems to be a user facing regression triggered by the particular 
internal function. So i do not see it as a bug.
   
   Given this is an internal API here, so again i will let the maintainers to 
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]

Reply via email to