Commit de60dfd0 authored by Robert Kimball's avatar Robert Kimball Committed by Adam Procter

much faster deserialize (#422)

parent b76f3f33
...@@ -308,12 +308,6 @@ static shared_ptr<ngraph::Function> ...@@ -308,12 +308,6 @@ static shared_ptr<ngraph::Function>
args.push_back(node_map.at(name)); args.push_back(node_map.at(name));
} }
vector<string> known_nodes;
for (auto x : node_map)
{
known_nodes.push_back(x.first);
}
if (node_op == "Abs") if (node_op == "Abs")
{ {
node = make_shared<op::Abs>(args[0]); node = make_shared<op::Abs>(args[0]);
......
...@@ -99,7 +99,22 @@ TEST(serialize, existing_models) ...@@ -99,7 +99,22 @@ TEST(serialize, existing_models)
{ {
const string json_path = file_util::path_join(SERIALIZED_ZOO, model); const string json_path = file_util::path_join(SERIALIZED_ZOO, model);
const string json_string = file_util::read_file_to_string(json_path); const string json_string = file_util::read_file_to_string(json_path);
stringstream ss(json_string); shared_ptr<Function> f = ngraph::deserialize(json_string);
shared_ptr<Function> f = ngraph::deserialize(ss);
} }
} }
TEST(benchmark, serialize)
{
stopwatch timer;
string model = "mxnet/LSTM_backward.json";
const string json_path = file_util::path_join(SERIALIZED_ZOO, model);
timer.start();
const string json_string = file_util::read_file_to_string(json_path);
timer.stop();
cout << "file read took " << timer.get_milliseconds() << "ms\n";
timer.start();
shared_ptr<Function> f = ngraph::deserialize(json_string);
timer.stop();
cout << "deserialize took " << timer.get_milliseconds() << "ms\n";
}
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