[coco] Pass Bag Link on the construction of InputManager (#888)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 3 Aug 2018 02:02:21 +0000 (11:02 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 3 Aug 2018 02:02:21 +0000 (11:02 +0900)
This commit revises the constructor of InputManager to take Bag Link
(Bag to BagInfo map) as its argument.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/coco/core/include/coco/IR/InputManager.h
contrib/coco/core/src/IR/InputManager.test.cpp
contrib/coco/core/src/IR/Module.cpp

index cc43723..0af359e 100644 (file)
@@ -4,13 +4,24 @@
 #include "coco/IR/Input.h"
 
 #include "coco/ADT/PtrManager.h"
+#include "coco/ADT/PtrLink.h"
 
 namespace coco
 {
 
 struct InputManager final : public PtrManager<Input>
 {
+public:
+  InputManager(const PtrLink<Bag, BagInfo> *bag_link) : _bag_link{bag_link}
+  {
+    // DO NOTHING
+  }
+
+public:
   Input *make(const nncc::core::ADT::tensor::Shape &);
+
+private:
+  const PtrLink<Bag, BagInfo> * const _bag_link;
 };
 
 } // namespace coco
index ed5ede8..3c60a2f 100644 (file)
@@ -4,10 +4,10 @@
 
 TEST(IR_INPUT_MANAGER, make)
 {
-  const nncc::core::ADT::tensor::Shape shape{1, 3, 3, 1};
-
-  coco::InputManager mgr;
+  const coco::PtrLink<coco::Bag, coco::BagInfo> bag_link;
+  coco::InputManager mgr{&bag_link};
 
+  const nncc::core::ADT::tensor::Shape shape{1, 3, 3, 1};
   auto input = mgr.make(shape);
 
   ASSERT_EQ(input->shape(), shape);
index 5afc09a..e32238c 100644 (file)
@@ -118,7 +118,7 @@ std::unique_ptr<Module> Module::create(void)
     mgr->_op = nncc::foundation::make_unique<coco::OpManager>();
     mgr->_instr = nncc::foundation::make_unique<coco::InstrManager>(ins_link.get());
     mgr->_block = nncc::foundation::make_unique<coco::BlockManager>(blk_link.get(), ins_link.get());
-    mgr->_input = nncc::foundation::make_unique<coco::InputManager>();
+    mgr->_input = nncc::foundation::make_unique<coco::InputManager>(bag_link.get());
     mgr->_output = nncc::foundation::make_unique<coco::OutputManager>();
   }
   m->_entity = std::move(mgr);