[coco] Add 'name' attribute to Input (#777)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 24 Jul 2018 06:00:47 +0000 (15:00 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 24 Jul 2018 06:00:47 +0000 (15:00 +0900)
This commit adds 'name' attribute to Input class.

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

index 9cf37e5..6486234 100644 (file)
@@ -5,6 +5,8 @@
 
 #include <nncc/core/ADT/tensor/Shape.h>
 
+#include <string>
+
 namespace coco
 {
 
@@ -25,6 +27,13 @@ public:
 
 private:
   Bag *_bag;
+
+public:
+  const std::string &name(void) const { return _name; }
+  void name(const std::string &s) { _name = s; }
+
+private:
+  std::string _name;
 };
 
 } // namespace coco
index 057482d..b93dd7d 100644 (file)
@@ -9,6 +9,7 @@ TEST(IR_INPUT, ctor_should_set_shape)
 
   ASSERT_EQ(input.shape(), shape);
   ASSERT_EQ(input.bag(), nullptr);
+  ASSERT_TRUE(input.name().empty());
 }
 
 TEST(IR_INPUT, bag_update)
@@ -20,3 +21,12 @@ TEST(IR_INPUT, bag_update)
   input.bag(&bag);
   ASSERT_EQ(input.bag(), &bag);
 }
+
+TEST(IR_INPUT, name_update)
+{
+  const nncc::core::ADT::tensor::Shape shape{1, 3, 3, 1};
+  coco::Input input{shape};
+
+  input.name("data");
+  ASSERT_EQ(input.name(), "data");
+}