Commit 45584004 by Tianqi Chen

[COMPILE] More debug message when compile error (#66)

parent f5a8a5c7
......@@ -95,9 +95,18 @@ def build_config(**kwargs):
@tvm.register_func("nnvm.compiler.lower")
def _lower(sch, inputs, func_name):
f = tvm.lower(sch, inputs, name=func_name)
logging.debug("lower function %s", func_name)
def _lower(sch, inputs, func_name, graph):
import traceback
# pylint: disable=broad-except
try:
f = tvm.lower(sch, inputs, name=func_name)
logging.debug("lower function %s", func_name)
except Exception:
msg = traceback.format_exc()
msg += "Error during compile graph\n"
msg += "--------------------------\n"
msg += graph.ir(join_entry_attrs=["shape"])
raise RuntimeError(msg)
return f if isinstance(
f, (tvm.container.Array, tuple, list)) else [f]
......
......@@ -369,7 +369,7 @@ def from_onnx(graph):
-------
sym : nnvm.Symbol
Compatible nnvm symbol
params : dict of str to tvm.ndarray
Dict of converted parameters stored in tvm.ndarray format
"""
......
......@@ -189,7 +189,7 @@ class CompileEngine {
gf->inputs = inputs;
gf->outputs = outputs;
static const PackedFunc& flower = GetPackedFunc("nnvm.compiler.lower");
gf->funcs = flower(sch, all_args, gf->func_name);
gf->funcs = flower(sch, all_args, gf->func_name, graph);
return GraphFunc(gf);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment