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

Function collect_symbolic_var_from_params

python/tvm/relax/script/parser/parser.py:179–196  ·  view source on GitHub ↗
(self: Parser, node: doc.FunctionDef)

Source from the content-addressed store, hash-verified

177
178
179def collect_symbolic_var_from_params(self: Parser, node: doc.FunctionDef) -> None:
180 # Collect symbolic vars from parameters
181 symbolic_vars = {}
182 for arg in node.args.args:
183 if arg.annotation is None:
184 self.report_error(arg, "Type annotation is required for function parameters.")
185 param_sinfo_proxy = eval_struct_info_proxy(self, arg.annotation)
186
187 for var_name in param_sinfo_proxy.get_symbolic_vars():
188 if var_name not in symbolic_vars:
189 symbolic_vars[var_name] = tirx.Var(var_name, "int64")
190
191 # Update symbolic vars based on
192 symbolic_vars = collect_symbolic_var_from_prelude(self, node, symbolic_vars)
193
194 # Define symbolic vars to the current var_table frame
195 for var_name, var in symbolic_vars.items():
196 self.var_table.add(var_name, var, allow_shadowing=False)
197
198
199@dispatch.register(token="relax", type_name="FunctionDef")

Callers 2

visit_function_defFunction · 0.85

Calls 6

eval_struct_info_proxyFunction · 0.85
report_errorMethod · 0.80
get_symbolic_varsMethod · 0.45
itemsMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…