Commit ec46aa7f authored by Robert Kimball's avatar Robert Kimball

cleanup

parent 654fdfa2
...@@ -172,30 +172,7 @@ void ngraph::traverse_nodes(ngraph::Function* p, std::function<void(shared_ptr<N ...@@ -172,30 +172,7 @@ void ngraph::traverse_nodes(ngraph::Function* p, std::function<void(shared_ptr<N
} }
} }
void ngraph::traverse_nodes(std::shared_ptr<ngraph::Node> p, void ngraph::free_nodes(shared_ptr<Function> p)
std::function<void(shared_ptr<Node>)> f)
{
std::unordered_set<shared_ptr<Node>> instances_seen;
deque<shared_ptr<Node>> stack;
stack.push_front(p);
while (stack.size() > 0)
{
shared_ptr<Node> n = stack.front();
if (instances_seen.find(n) == instances_seen.end())
{
instances_seen.insert(n);
f(n);
}
stack.pop_front();
for (auto arg : n->get_arguments())
{
stack.push_front(arg);
}
}
}
void ngraph::free_nodes(shared_ptr<Node> p)
{ {
std::deque<Node*> sorted_list; std::deque<Node*> sorted_list;
......
...@@ -200,7 +200,5 @@ namespace ngraph ...@@ -200,7 +200,5 @@ namespace ngraph
void traverse_nodes(std::shared_ptr<Function> p, std::function<void(std::shared_ptr<Node>)> f); void traverse_nodes(std::shared_ptr<Function> p, std::function<void(std::shared_ptr<Node>)> f);
void traverse_nodes(std::shared_ptr<Node> p, std::function<void(std::shared_ptr<Node>)> f); void free_nodes(std::shared_ptr<Function>);
void free_nodes(std::shared_ptr<Node>);
} // end namespace ngraph } // end namespace ngraph
...@@ -136,7 +136,7 @@ TEST(benchmark, topological_sort) ...@@ -136,7 +136,7 @@ TEST(benchmark, topological_sort)
NGRAPH_INFO << "node count " << node_count; NGRAPH_INFO << "node count " << node_count;
timer.start(); timer.start();
ngraph::free_nodes(f0->get_result()); ngraph::free_nodes(f0);
timer.stop(); timer.stop();
NGRAPH_INFO << "delete nodes took " << timer.get_milliseconds() << "ms"; NGRAPH_INFO << "delete nodes took " << timer.get_milliseconds() << "ms";
} }
......
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