Browse Source

fix(mge/imperative): clear log message

GitOrigin-RevId: 051264cac3
tags/v1.0.0-rc1
Megvii Engine Team 4 years ago
parent
commit
1c9430e2c6
2 changed files with 10 additions and 0 deletions
  1. +8
    -0
      imperative/python/tools/gen_ops.py
  2. +2
    -0
      imperative/src/impl/op_trait.cpp

+ 8
- 0
imperative/python/tools/gen_ops.py View File

@@ -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)]


+ 2
- 0
imperative/src/impl/op_trait.cpp View File

@@ -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;
}



Loading…
Cancel
Save