提交 1c9430e2 编写于 作者: M Megvii Engine Team

fix(mge/imperative): clear log message

GitOrigin-RevId: 051264cac3eabfdb3d6ccc0a46586b9a4f258bb5
上级 a226f02e
......@@ -52,6 +52,7 @@ class Context:
self.indent = 0
self.generated = []
self.skipped = []
self.generated_signature = set()
def write(self, text, *fmt, indent=0):
text = textwrap.dedent(text)
......@@ -184,6 +185,13 @@ class Context:
self.skipped.append(name)
return
signature = (name, params if isinstance(params, str) else frozenset(params), has_out_dtype, version)
if signature in self.generated_signature:
self.skipped.append(name)
return
else:
self.generated_signature.add(signature)
body = body or []
if isinstance(params, str):
params = [('param', params)]
......
......@@ -87,12 +87,14 @@ OpTraitRegistry& OpTraitRegistry::finalize() {
CHECK(infer_output_attrs);
CHECK(make_backward_graph);
#undef CHECK
#ifdef DEBUG
if (msg.tellp() > 0) {
mgb_log_warn(
"%s op trait missing: %s",
trait->name ? trait->name : "(anonymous)",
msg.str().c_str() + 2 /* skip first ", " */);
}
#endif
return *this;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册