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

Method display_attrs

python/tvm/relax/testing/ast_printer.py:170–184  ·  view source on GitHub ↗
(attr_key)

Source from the content-addressed store, hash-verified

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()),

Callers

nothing calls this directly

Calls 1

wrap_quotesFunction · 0.85

Tested by

no test coverage detected