MCPcopy Create free account
hub / github.com/apache/tvm / to_doc

Function to_doc

python/tvm/script/parser/core/doc.py:160–182  ·  view source on GitHub ↗

Get doc AST node from python AST node. Parameters ---------- node : ast.AST The AST node. Returns ------- res : doc.AST The corresponding doc AST node.

(node)

Source from the content-addressed store, hash-verified

158
159
160def to_doc(node):
161 """Get doc AST node from python AST node.
162
163 Parameters
164 ----------
165 node : ast.AST
166 The AST node.
167
168 Returns
169 -------
170 res : doc.AST
171 The corresponding doc AST node.
172 """
173 if _is_atomic_type(node):
174 return node
175 if isinstance(node, tuple):
176 return tuple(to_doc(n) for n in node)
177 if isinstance(node, list):
178 return [to_doc(n) for n in node]
179 func = _get_registry_entry(node.__class__.__name__, "to_doc")
180 if not func:
181 raise NotImplementedError(f"to_doc is not implemented for: {node.__class__.__name__}")
182 return func(node)
183
184
185def parse(

Callers 1

parseFunction · 0.85

Calls 4

_is_atomic_typeFunction · 0.85
tupleFunction · 0.85
_get_registry_entryFunction · 0.85
funcFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…