From: 박천교/On-Device Lab(SR)/Engineer/삼성전자 Date: Mon, 25 Nov 2019 23:02:02 +0000 (+0900) Subject: [exo] Remove deprecated CommutativeArgsGetter (#9188) X-Git-Tag: submit/tizen/20191205.083104~134 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4cc507eba93354477417ea18a3894f5f6c31c4cc;p=platform%2Fcore%2Fml%2Fnnfw.git [exo] Remove deprecated CommutativeArgsGetter (#9188) This commit removes deprecated `CommutativeArgsGetter`. This is replaced by `NodeFiller`. Comment for helper also updated. Signed-off-by: Cheongyo Bahk --- diff --git a/compiler/exo/src/Pass/FuseInstanceNormPass.cpp b/compiler/exo/src/Pass/FuseInstanceNormPass.cpp index 45416b2..a3e21c6 100644 --- a/compiler/exo/src/Pass/FuseInstanceNormPass.cpp +++ b/compiler/exo/src/Pass/FuseInstanceNormPass.cpp @@ -40,7 +40,7 @@ namespace * ARG_TYPE_1 *arg1; * ARG_TYPE_2 *arg2; * - * bool ok = commutative_args_of(node).is(arg1, arg2); + * bool ok = fill(&arg1, &arg2).with_commutative_args_of(node); * * Result * If 'node's commutative argument types are actually {ARG_TYPE_1, ARG_TYPE_2} @@ -49,81 +49,6 @@ namespace * Otherwise, 'arg1' and 'arg2' not changed, 'ok' is false. */ -/// @require COMM_NODE has member x() and y() -template class CommutativeArgsGetter final -{ -public: - CommutativeArgsGetter(COMM_NODE *node) : _node(node) - { - assert(node); - assert(node->arity() == 2); - assert(node->x()); - assert(node->y()); - } - -public: - /** - * @note This function might make change to arguments - * - * @param[out] arg_* These would be set to actual argument node pointer on check success - * - * @return true When '_node's argument types are 'ARG_TYPE_1' and 'ARG_TYPE_2' - * In such case, it assign 'arg_1' and 'arg_2' to actual arguments - * - * @return false When '_node's argument types are NOT matched with 'ARG_TYPE_*' - * In such case, it does not amend 'arg_1' and 'arg_2' - */ - template bool is(ARG_TYPE_1 *&arg_1, ARG_TYPE_2 *&arg_2); - -private: - COMM_NODE *_node = nullptr; -}; - -template -inline CommutativeArgsGetter commutative_args_of(COMM_NODE *node) -{ - return CommutativeArgsGetter{node}; -} - -template -template -bool CommutativeArgsGetter::is(ARG_TYPE_1 *&arg_1, ARG_TYPE_2 *&arg_2) -{ - // Case 1) X == ARG_TYPE_1 / Y == ARG_TYPE_2 - { - auto x = dynamic_cast(_node->x()); - auto y = dynamic_cast(_node->y()); - - if (x && y) - { - arg_1 = x; - arg_2 = y; - return true; - } - } - - // Case 2) X == ARG_TYPE_2 / Y == ARG_TYPE_1 - { - auto x = dynamic_cast(_node->x()); - auto y = dynamic_cast(_node->y()); - - if (x && y) - { - arg_1 = y; - arg_2 = x; - return true; - } - } - - return false; -} - -/** - * Alternative approach - * - * bool ok = fill(&arg1, &arg2).with_commutative_args_of(node); - */ - template class NodeFiller final { public: