[coco] Add 'Output' class (#735)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 20 Jul 2018 05:39:29 +0000 (14:39 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 20 Jul 2018 05:39:29 +0000 (14:39 +0900)
This commit adds 'Output' class which records informations related with
a network's output.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/coco/core/include/coco/IR/Output.h [new file with mode: 0644]
contrib/coco/core/src/IR/Output.cpp [new file with mode: 0644]
contrib/coco/core/src/IR/Output.test.cpp [new file with mode: 0644]

diff --git a/contrib/coco/core/include/coco/IR/Output.h b/contrib/coco/core/include/coco/IR/Output.h
new file mode 100644 (file)
index 0000000..19bcc9c
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef __COCO_IR_OUTPUT_H__
+#define __COCO_IR_OUTPUT_H__
+
+#include <nncc/core/ADT/tensor/Shape.h>
+
+namespace coco
+{
+
+class Output
+{
+public:
+  Output(const nncc::core::ADT::tensor::Shape &shape);
+
+public:
+  const nncc::core::ADT::tensor::Shape &shape(void) const { return _shape; }
+
+private:
+  nncc::core::ADT::tensor::Shape const _shape;
+};
+
+} // namespace coco
+
+#endif // __COCO_IR_OUTPUT_H__
diff --git a/contrib/coco/core/src/IR/Output.cpp b/contrib/coco/core/src/IR/Output.cpp
new file mode 100644 (file)
index 0000000..65ca955
--- /dev/null
@@ -0,0 +1,11 @@
+#include "coco/IR/Output.h"
+
+namespace coco
+{
+
+Output::Output(const nncc::core::ADT::tensor::Shape &shape) : _shape{shape}
+{
+  // DO NOTHING
+}
+
+} // namespace coco
diff --git a/contrib/coco/core/src/IR/Output.test.cpp b/contrib/coco/core/src/IR/Output.test.cpp
new file mode 100644 (file)
index 0000000..23b7a4a
--- /dev/null
@@ -0,0 +1,11 @@
+#include "coco/IR/Output.h"
+
+#include <gtest/gtest.h>
+
+TEST(IR_OUTPUT, ctor_should_set_shape)
+{
+  const nncc::core::ADT::tensor::Shape shape{1, 3, 3, 1};
+  coco::Output output{shape};
+
+  ASSERT_EQ(output.shape(), shape);
+}