(self, op: relax.Call)
| 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( |
nothing calls this directly
no test coverage detected