Skip to content

Commit

Permalink
[luci-interpreter] Move collectOutputNodes function (Samsung#7615)
Browse files Browse the repository at this point in the history
This PR moves collectOutputNodes function to prepare splitting of
KernelBuilder.cpp to smaller files.

Signed-off-by: Alexander Efimov <[email protected]>
  • Loading branch information
binarman authored Sep 8, 2021
1 parent 9d06449 commit dd63265
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
20 changes: 0 additions & 20 deletions compiler/luci-interpreter/src/loader/KernelBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,6 @@

#include <stdexcept>

namespace
{

template <typename CircleNodeOut>
std::vector<const loco::Node *> collectOutputNodes(const luci::CircleNode *node)
{
std::vector<const CircleNodeOut *> output_nodes;
for (const loco::Node *loco_node : loco::succs(node))
{
output_nodes.push_back(loco::must_cast<const CircleNodeOut *>(loco_node));
}
std::sort(output_nodes.begin(), output_nodes.end(),
[](const CircleNodeOut *node1, const CircleNodeOut *node2) {
return node1->index() < node2->index();
});
return {output_nodes.cbegin(), output_nodes.cend()};
}

} // namespace

namespace luci_interpreter
{

Expand Down
15 changes: 15 additions & 0 deletions compiler/luci-interpreter/src/loader/KernelBuilderHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ class KernelBuilderHelper
const std::unordered_map<const loco::Node *, Tensor *> &_node_to_tensor;
};

template <typename CircleNodeOut>
std::vector<const loco::Node *> collectOutputNodes(const loco::Node *node)
{
std::vector<const CircleNodeOut *> output_nodes;
for (const loco::Node *loco_node : loco::succs(node))
{
output_nodes.push_back(loco::must_cast<const CircleNodeOut *>(loco_node));
}
std::sort(output_nodes.begin(), output_nodes.end(),
[](const CircleNodeOut *node1, const CircleNodeOut *node2) {
return node1->index() < node2->index();
});
return {output_nodes.cbegin(), output_nodes.cend()};
}

} // namespace luci_interpreter

#endif // LUCI_INTERPRETER_LOADER_KERNELBUILDER_HELPER_H

0 comments on commit dd63265

Please sign in to comment.