From e91f3626abcbe4a7cd2652a6de1ac136e77e308d 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: Tue, 24 Jul 2018 15:00:47 +0900 Subject: [PATCH] [coco] Add 'name' attribute to Input (#777) This commit adds 'name' attribute to Input class. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/Input.h | 9 +++++++++ contrib/coco/core/src/IR/Input.test.cpp | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/contrib/coco/core/include/coco/IR/Input.h b/contrib/coco/core/include/coco/IR/Input.h index 9cf37e5..6486234 100644 --- a/contrib/coco/core/include/coco/IR/Input.h +++ b/contrib/coco/core/include/coco/IR/Input.h @@ -5,6 +5,8 @@ #include +#include + 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 diff --git a/contrib/coco/core/src/IR/Input.test.cpp b/contrib/coco/core/src/IR/Input.test.cpp index 057482d..b93dd7d 100644 --- a/contrib/coco/core/src/IR/Input.test.cpp +++ b/contrib/coco/core/src/IR/Input.test.cpp @@ -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"); +} -- 2.7.4