MCPcopy Index your code
hub / github.com/apache/tvm / script

Method script

python/tvm/runtime/script_printer.py:121–251  ·  view source on GitHub ↗

Print TVM IR into TVMScript text format Parameters ---------- name : Optional[str] = None The name of the object show_meta : bool = False Whether to print the meta data of the object ir_prefix : str = "I" The prefix of AST

(
        self,
        *,
        name: str | None = None,
        show_meta: bool = False,
        ir_prefix: str = "I",
        module_alias: str = "cls",
        int_dtype: str = "int32",
        float_dtype: str = "void",
        verbose_expr: bool = False,
        indent_spaces: int = 4,
        print_line_numbers: bool = False,
        num_context_lines: int = -1,
        syntax_sugar: bool = True,
        show_object_address: bool = False,
        show_all_struct_info: bool = True,
        extra_config: dict | None = None,
        path_to_underline: list[AccessPath] | None = None,
        path_to_annotate: dict[AccessPath, str] | None = None,
        obj_to_underline: list[Object] | None = None,
        obj_to_annotate: dict[Object, str] | None = None,
    )

Source from the content-addressed store, hash-verified

119 """A base class that enables the script() and show() method."""
120
121 def script(
122 self,
123 *,
124 name: str | None = None,
125 show_meta: bool = False,
126 ir_prefix: str = "I",
127 module_alias: str = "cls",
128 int_dtype: str = "int32",
129 float_dtype: str = "void",
130 verbose_expr: bool = False,
131 indent_spaces: int = 4,
132 print_line_numbers: bool = False,
133 num_context_lines: int = -1,
134 syntax_sugar: bool = True,
135 show_object_address: bool = False,
136 show_all_struct_info: bool = True,
137 extra_config: dict | None = None,
138 path_to_underline: list[AccessPath] | None = None,
139 path_to_annotate: dict[AccessPath, str] | None = None,
140 obj_to_underline: list[Object] | None = None,
141 obj_to_annotate: dict[Object, str] | None = None,
142 ) -> str:
143 """Print TVM IR into TVMScript text format
144
145 Parameters
146 ----------
147 name : Optional[str] = None
148 The name of the object
149 show_meta : bool = False
150 Whether to print the meta data of the object
151 ir_prefix : str = "I"
152 The prefix of AST nodes from tvm.ir
153 module_alias : str = "cls"
154 The alias of the current module at cross-function call,
155 Directly use module name if it's empty.
156 int_dtype : str = "int32"
157 The default data type of integer
158 float_dtype : str = "void"
159 The default data type of float
160 verbose_expr : bool = False
161 Whether to print the detailed definition of each variable in the expression
162 indent_spaces : int = 4
163 The number of spaces for indentation
164 print_line_numbers : bool = False
165 Whether to print line numbers
166 num_context_lines : int = -1
167 The number of lines of context to print before and after the line to underline.
168 syntax_sugar: bool = True
169 Whether to output with syntax sugar, set false for complete printing.
170 show_object_address: bool = False
171 Whether to include the object's address as part of the TVMScript name
172 show_all_struct_info: bool = True
173 If True (default), annotate all variable bindings with the struct
174 info of that variable. If False, only add annotations where
175 required for unambiguous round-trip of Relax -> TVMScript -> Relax.
176 extra_config : Optional[dict] = None
177 Dialect-specific configuration passed through to PrinterConfig.extra_config.
178 Keys are conventionally namespaced as "<dialect>.<knob>", e.g.

Callers 1

showMethod · 0.95

Calls 5

_scriptFunction · 0.85
PrinterConfigClass · 0.85
updateMethod · 0.45
getMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected