From b162853973deadb7d4cbb855c5fb3c491648a2f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=84=B8=ED=9D=AC/On-Device=20Lab=28SR=29/Princip?= =?utf8?q?al=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Thu, 8 Aug 2019 16:58:52 +0900 Subject: [PATCH] [moco-tf] relocate input method in Concat import (#6394) This will relocate input method in Concat after class declaration to put anonymous codes together Signed-off-by: SaeHie Park --- compiler/moco-tf/src/Op/Concat.cpp | 82 ++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/compiler/moco-tf/src/Op/Concat.cpp b/compiler/moco-tf/src/Op/Concat.cpp index bbdfb45..7f81cce 100644 --- a/compiler/moco-tf/src/Op/Concat.cpp +++ b/compiler/moco-tf/src/Op/Concat.cpp @@ -70,6 +70,44 @@ private: std::vector _names; }; +void ConcatV2GraphUpdate::input(const SymbolTable *tensor_names) const +{ + int num_inputs = _names.size(); + assert(num_inputs >= 2); + assert(num_inputs == _nodes.size()); + + loco::Node *target; + // do "%0.lhs : %in[0].name" connection + target = tensor_names->node(_names[0]); + _nodes[0]->lhs(target); + + for (int i = 1; i < num_inputs; ++i) + { + // do "%i.rhs : %in[i].name" connections + target = tensor_names->node(_names[i]); + _nodes[i]->rhs(target); + } +} + +void TFConcatV2GraphUpdate::input(const SymbolTable *tensor_names) const +{ + int num_inputs = _names.size(); + assert(num_inputs >= 2); + assert(num_inputs == _nodes.size()); + + loco::Node *target; + // do "%0.lhs : %in[0].name" connection + target = tensor_names->node(_names[0]); + _nodes[0]->lhs(target); + + for (int i = 1; i < num_inputs; ++i) + { + // do "%i.rhs : %in[i].name" connections + target = tensor_names->node(_names[i]); + _nodes[i]->rhs(target); + } +} + } // namespace namespace moco @@ -302,50 +340,6 @@ void ConcatV2GraphBuilderImpl::build(const tensorflow: } // namespace tf } // namespace moco -// TODO move this block to upperside -namespace -{ - -void ConcatV2GraphUpdate::input(const SymbolTable *tensor_names) const -{ - int num_inputs = _names.size(); - assert(num_inputs >= 2); - assert(num_inputs == _nodes.size()); - - loco::Node *target; - // do "%0.lhs : %in[0].name" connection - target = tensor_names->node(_names[0]); - _nodes[0]->lhs(target); - - for (int i = 1; i < num_inputs; ++i) - { - // do "%i.rhs : %in[i].name" connections - target = tensor_names->node(_names[i]); - _nodes[i]->rhs(target); - } -} - -void TFConcatV2GraphUpdate::input(const SymbolTable *tensor_names) const -{ - int num_inputs = _names.size(); - assert(num_inputs >= 2); - assert(num_inputs == _nodes.size()); - - loco::Node *target; - // do "%0.lhs : %in[0].name" connection - target = tensor_names->node(_names[0]); - _nodes[0]->lhs(target); - - for (int i = 1; i < num_inputs; ++i) - { - // do "%i.rhs : %in[i].name" connections - target = tensor_names->node(_names[i]); - _nodes[i]->rhs(target); - } -} - -} // namespace - #include "GraphBuilderRegistry.h" REGISTER_OP_BUILDER(ConcatV2, ConcatV2GraphBuilder) -- 2.7.4