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

Function from_doc

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

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

(node)

Source from the content-addressed store, hash-verified

133
134
135def from_doc(node):
136 """Get original python AST node from doc AST node.
137
138 Parameters
139 ----------
140 node : doc.AST
141 The doc AST node.
142
143 Returns
144 -------
145 res : ast.AST
146 The corresponding AST node.
147 """
148 if _is_atomic_type(node):
149 return node
150 if isinstance(node, tuple):
151 return tuple(from_doc(n) for n in node)
152 if isinstance(node, list):
153 return [from_doc(n) for n in node]
154 func = _get_registry_entry(node.__class__.__name__, "from_doc")
155 if not func:
156 raise NotImplementedError(f"from_doc is not implemented for: {node.__class__.__name__}")
157 return func(node)
158
159
160def to_doc(node):

Callers 1

get_funcFunction · 0.90

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…