[coco] Configurable MaxPool2D window size (#1313)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 4 Sep 2018 02:18:00 +0000 (11:18 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 4 Sep 2018 02:18:00 +0000 (11:18 +0900)
This commit introduces a field and methods related with window (=
receptive field) configuration.

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

index d1ce01a..b319348 100644 (file)
@@ -2,6 +2,7 @@
 #define __COCO_IR_MAX_POOL_2D_H__
 
 #include "coco/IR/Op.h"
+#include "coco/IR/Window2D.h"
 
 namespace coco
 {
@@ -25,11 +26,18 @@ public:
   MaxPool2D *asMaxPool2D(void) override { return this; }
   const MaxPool2D *asMaxPool2D(void) const override { return this; }
 
+public:
+  Window2D *window(void) { return &_window; }
+  const Window2D *window(void) const { return &_window; }
+
 private:
   void get(const PtrLink<Op, Instr> **out) const override { *out = _op_link; }
 
 private:
   const PtrLink<Op, Instr> *const _op_link;
+
+private:
+  Window2D _window;
 };
 
 } // namespace coco
index 718aef5..187e3f8 100644 (file)
@@ -40,10 +40,17 @@ TEST_F(MaxPool2DTest, initialization)
 {
   auto op = allocate();
 
+  coco::MaxPool2D *mutable_ptr = op;
+  const coco::MaxPool2D *immutable_ptr = op;
+
   // uses() should be empty on construction
   ASSERT_EQ(op->uses().size(), 0);
   // parent() should be nullptr on construction
   ASSERT_EQ(op->parent(), nullptr);
+
+  // window() SHOULD return a valid pointer
+  ASSERT_NE(mutable_ptr->window(), nullptr);
+  ASSERT_EQ(mutable_ptr->window(), immutable_ptr->window());
 }
 
 TEST_F(MaxPool2DTest, asMaxPool2D)