From: 박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Wed, 25 Jul 2018 23:47:36 +0000 (+0900) Subject: [coco] Non-template UnitF instruction (#789) X-Git-Tag: nncc_backup~2305 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e1a124b753e0e7b2d8419157b399f95969ae313;p=platform%2Fcore%2Fml%2Fnnfw.git [coco] Non-template UnitF instruction (#789) * [coco] Non-template UnitF instruction This commit revises UnitF instruction class as a non-template class. Signed-off-by: Jonghyun Park * Simplify 'create' method --- diff --git a/contrib/coco/core/include/coco/IR/Instr.h b/contrib/coco/core/include/coco/IR/Instr.h index 70f1b1f..56a2001 100644 --- a/contrib/coco/core/include/coco/IR/Instr.h +++ b/contrib/coco/core/include/coco/IR/Instr.h @@ -79,15 +79,17 @@ public: // // UnitF // +#include "coco/IR/Op.forward.h" + namespace coco { /** * @brief Feature map-to-feature map step with single NN operation * - * TODO Restrict 'OpImpl' + * TODO Introduce 'FeatureOp' and use it */ -template class UnitF final : public FeatureInstr +class UnitF final : public FeatureInstr { public: UnitF(const PtrLink *link) : FeatureInstr{link}, _op{nullptr} @@ -96,13 +98,13 @@ public: } private: - OpImpl *_op; + Op *_op; public: - OpImpl *op(void) const { return _op; } + Op *op(void) const { return _op; } public: - void op(OpImpl *op) + void op(Op *op) { // TODO Update Op-Instr relation _op = op; diff --git a/contrib/coco/core/include/coco/IR/InstrManager.h b/contrib/coco/core/include/coco/IR/InstrManager.h index 580ae84..ecfde65 100644 --- a/contrib/coco/core/include/coco/IR/InstrManager.h +++ b/contrib/coco/core/include/coco/IR/InstrManager.h @@ -17,7 +17,7 @@ public: } public: - template UnitF *createF(void); + template Ins *create(void); private: const PtrLink * const _instr_link; diff --git a/contrib/coco/core/include/coco/IR/Op.forward.h b/contrib/coco/core/include/coco/IR/Op.forward.h new file mode 100644 index 0000000..8db7044 --- /dev/null +++ b/contrib/coco/core/include/coco/IR/Op.forward.h @@ -0,0 +1,11 @@ +#ifndef __COCO_IR_OP_FORWARD_H__ +#define __COCO_IR_OP_FORWARD_H__ + +namespace coco +{ + +struct Op; + +} // namespace coco + +#endif // __COCO_IR_OP_FORWARD_H__ diff --git a/contrib/coco/core/src/IR/Instr.test.cpp b/contrib/coco/core/src/IR/Instr.test.cpp index 1b0fcb2..31ebaeb 100644 --- a/contrib/coco/core/src/IR/Instr.test.cpp +++ b/contrib/coco/core/src/IR/Instr.test.cpp @@ -56,7 +56,7 @@ struct DummyOp : public coco::Op TEST(IR_UNIT_F, ctor) { coco::PtrLink link; - coco::UnitF<::DummyOp> ins{&link}; + coco::UnitF ins{&link}; ASSERT_EQ(ins.op(), nullptr); } @@ -64,7 +64,7 @@ TEST(IR_UNIT_F, ctor) TEST(IR_UNIT_F, op_update) { coco::PtrLink link; - coco::UnitF<::DummyOp> ins{&link}; + coco::UnitF ins{&link}; ::DummyOp op{}; diff --git a/contrib/coco/core/src/IR/InstrManager.cpp b/contrib/coco/core/src/IR/InstrManager.cpp index 8fe525e..95993e1 100644 --- a/contrib/coco/core/src/IR/InstrManager.cpp +++ b/contrib/coco/core/src/IR/InstrManager.cpp @@ -7,9 +7,9 @@ namespace coco { -template<> UnitF *InstrManager::createF() +template<> UnitF *InstrManager::create(void) { - return take(nncc::foundation::make_unique>(_instr_link)); + return take(nncc::foundation::make_unique(_instr_link)); } } // namespace coco diff --git a/contrib/coco/core/src/IR/InstrManager.test.cpp b/contrib/coco/core/src/IR/InstrManager.test.cpp index 03f9e53..70968c2 100644 --- a/contrib/coco/core/src/IR/InstrManager.test.cpp +++ b/contrib/coco/core/src/IR/InstrManager.test.cpp @@ -10,7 +10,7 @@ TEST(IR_INSTR_MANAGER, create_UnitF) // Conv2D { - auto ins = mgr.createF(); + auto ins = mgr.create(); ASSERT_NE(ins, nullptr); } }