A sugar for print highlighted TVM script with Python function support. This method extends the standard IRModule show() method to handle Python functions stored in the IRModule's pyfuncs attribute.
(self, style: str | None = None, black_format: bool | None = None, **kwargs)
| 601 | return "\n".join(formatted_lines) |
| 602 | |
| 603 | def show(self, style: str | None = None, black_format: bool | None = None, **kwargs) -> None: |
| 604 | """A sugar for print highlighted TVM script with Python function support. |
| 605 | |
| 606 | This method extends the standard IRModule show() method to handle |
| 607 | Python functions stored in the IRModule's pyfuncs attribute. |
| 608 | """ |
| 609 | from tvm.script.highlight import cprint # pylint: disable=import-outside-toplevel |
| 610 | |
| 611 | if black_format is None: |
| 612 | env = os.environ.get("TVM_BLACK_FORMAT") |
| 613 | black_format = env and int(env) |
| 614 | |
| 615 | script_content = self.script(**kwargs) |
| 616 | cprint(script_content, style=style, black_format=black_format) |