[coco] Record output name (#783)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 24 Jul 2018 10:30:29 +0000 (19:30 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 24 Jul 2018 10:30:29 +0000 (19:30 +0900)
This commit revises 'Output' class to record its name.

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

index 2748dbd..8a48470 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 fe804ff..2f00923 100644 (file)
@@ -20,3 +20,12 @@ TEST(IR_OUTPUT, bag_update)
   output.bag(&bag);
   ASSERT_EQ(output.bag(), &bag);
 }
+
+TEST(IR_OUTPUT, name_update)
+{
+  const nncc::core::ADT::tensor::Shape shape{1, 3, 3, 1};
+  coco::Output output{shape};
+
+  output.name("softmax");
+  ASSERT_EQ(output.name(), "softmax");
+}