From b05ae9c9df704b8200796580db555e34865ba136 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Mon, 23 Jul 2018 09:21:09 +0900 Subject: [PATCH] [coco] Implement 'InputManager' class (#741) This commit implements 'InputManager' class which serves as a Input (IR entity) factory. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/InputManager.h | 18 ++++++++++++++++++ contrib/coco/core/src/IR/InputManager.cpp | 13 +++++++++++++ contrib/coco/core/src/IR/InputManager.test.cpp | 14 ++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 contrib/coco/core/include/coco/IR/InputManager.h create mode 100644 contrib/coco/core/src/IR/InputManager.cpp create mode 100644 contrib/coco/core/src/IR/InputManager.test.cpp diff --git a/contrib/coco/core/include/coco/IR/InputManager.h b/contrib/coco/core/include/coco/IR/InputManager.h new file mode 100644 index 0000000..cc43723 --- /dev/null +++ b/contrib/coco/core/include/coco/IR/InputManager.h @@ -0,0 +1,18 @@ +#ifndef __COCO_IR_INPUT_MANAGER_H__ +#define __COCO_IR_INPUT_MANAGER_H__ + +#include "coco/IR/Input.h" + +#include "coco/ADT/PtrManager.h" + +namespace coco +{ + +struct InputManager final : public PtrManager +{ + Input *make(const nncc::core::ADT::tensor::Shape &); +}; + +} // namespace coco + +#endif // __COCO_IR_INPUT_MANAGER_H__ diff --git a/contrib/coco/core/src/IR/InputManager.cpp b/contrib/coco/core/src/IR/InputManager.cpp new file mode 100644 index 0000000..fd15529 --- /dev/null +++ b/contrib/coco/core/src/IR/InputManager.cpp @@ -0,0 +1,13 @@ +#include "coco/IR/InputManager.h" + +#include + +namespace coco +{ + +Input *InputManager::make(const nncc::core::ADT::tensor::Shape &shape) +{ + return take(nncc::foundation::make_unique(shape)); +} + +} // namespace coco diff --git a/contrib/coco/core/src/IR/InputManager.test.cpp b/contrib/coco/core/src/IR/InputManager.test.cpp new file mode 100644 index 0000000..ed5ede8 --- /dev/null +++ b/contrib/coco/core/src/IR/InputManager.test.cpp @@ -0,0 +1,14 @@ +#include "coco/IR/InputManager.h" + +#include + +TEST(IR_INPUT_MANAGER, make) +{ + const nncc::core::ADT::tensor::Shape shape{1, 3, 3, 1}; + + coco::InputManager mgr; + + auto input = mgr.make(shape); + + ASSERT_EQ(input->shape(), shape); +} -- 2.7.4