Unverified Commit a1269685 authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

add exception handing in deserializer to tell which op actually caused the exception (#756)

parent 71c2055c
......@@ -338,6 +338,8 @@ static shared_ptr<ngraph::Function>
vector<string> func_result = func_js.at("result").get<vector<string>>();
unordered_map<string, shared_ptr<Node>> node_map;
for (json node_js : func_js.at("ops"))
{
try
{
string node_name = node_js.at("name").get<string>();
string node_op = node_js.at("op").get<string>();
......@@ -642,8 +644,11 @@ static shared_ptr<ngraph::Function>
{
auto padding_below = padding_below_maybe.get<vector<size_t>>();
auto padding_above = padding_above_maybe.get<vector<size_t>>();
node = make_shared<op::MaxPool>(
args[0], window_shape, window_movement_strides, padding_below, padding_above);
node = make_shared<op::MaxPool>(args[0],
window_shape,
window_movement_strides,
padding_below,
padding_above);
}
else
{
......@@ -857,6 +862,20 @@ static shared_ptr<ngraph::Function>
// the serialization for debugging.
// node->set_name(node_name);
}
catch (...)
{
string node_name;
try
{
node_name = node_js.at("name").get<string>();
}
catch (...)
{
node_name = "UNKNOWN";
}
throw runtime_error("Error parsing json at node '" + node_name + "'");
}
}
//This handles both graphs w/ `op::Result` and legacy graphs w/o it
//If we are dealing w/ a legacy graph, add op::Result for each output node
......
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