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

Method visit_call_

python/tvm/relax/testing/ast_printer.py:161–191  ·  view source on GitHub ↗
(self, op: relax.Call)

Source from the content-addressed store, hash-verified

159 return self.build_expr(op, "Function", **fields)
160
161 def visit_call_(self, op: relax.Call) -> str:
162 fields = {
163 "op": self.visit_expr(op.op),
164 "args": self.build_list(map(self.visit_expr, op.args)),
165 }
166 if op.sinfo_args:
167 fields["sinfo_args"] = self.build_list(map(self.visit_struct_info_, op.sinfo_args))
168 if op.attrs and self.include_call_attrs:
169
170 def display_attrs(attr_key):
171 attr_val = op.attrs[attr_key]
172
173 if isinstance(attr_val, str):
174 # attrs can be strings but also other types;
175 # we want to wrap strings in quotes
176 # (__repr__ would work but it uses single quotes)
177 attr_val = wrap_quotes(attr_val)
178 elif isinstance(attr_val, tvm.tirx.IntImm):
179 if attr_val.dtype == "bool":
180 attr_val = bool(attr_val.value)
181 else:
182 attr_val = int(attr_val.value)
183
184 return f"{wrap_quotes(attr_key)}: {attr_val}"
185
186 fields["attrs"] = self.build_list(
187 map(display_attrs, op.attrs.keys()),
188 open_tok="{",
189 close_tok="}",
190 )
191 return self.build_expr(op, "Call", **fields)
192
193 def visit_seq_expr_(self, op: relax.SeqExpr) -> str:
194 return self.build_expr(

Callers

nothing calls this directly

Calls 4

visit_exprMethod · 0.95
build_listMethod · 0.95
build_exprMethod · 0.95
keysMethod · 0.45

Tested by

no test coverage detected