MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / as_text

Method as_text

imperative/python/megengine/xla/compile.py:161–175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

159 raise NotImplementedError("should be overrided")
160
161 def as_text(self) -> str:
162 xla_ext_exe = self.xla_extension_executable()
163 err_msg = (
164 "text view unsupported on current XLA backend: " f"{type(xla_ext_exe)}"
165 )
166 if not hasattr(xla_ext_exe, "hlo_modules"):
167 raise NotImplementedError(err_msg)
168 try:
169 return "\n\n".join([m.to_string() for m in xla_ext_exe.hlo_modules()])
170 except xla_extension.XlaRuntimeError as e:
171 msg, *_ = e.args
172 if type(msg) is str and msg.startswith("UNIMPLEMENTED"):
173 raise NotImplementedError(err_msg) from e
174 else:
175 raise
176
177 def cost_analysis(self) -> List[Dict[str, float]]:
178 xla_ext_exe = self.xla_extension_executable()

Callers

nothing calls this directly

Calls 3

joinMethod · 0.80
to_stringMethod · 0.45

Tested by

no test coverage detected