From 680ade5579dea59035b0dc2e917d1d9dcd8149d2 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, 4 Sep 2018 11:18:00 +0900 Subject: [PATCH] [coco] Configurable MaxPool2D window size (#1313) This commit introduces a field and methods related with window (= receptive field) configuration. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/MaxPool2D.h | 8 ++++++++ contrib/coco/core/src/IR/MaxPool2D.test.cpp | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/contrib/coco/core/include/coco/IR/MaxPool2D.h b/contrib/coco/core/include/coco/IR/MaxPool2D.h index d1ce01a..b319348 100644 --- a/contrib/coco/core/include/coco/IR/MaxPool2D.h +++ b/contrib/coco/core/include/coco/IR/MaxPool2D.h @@ -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 **out) const override { *out = _op_link; } private: const PtrLink *const _op_link; + +private: + Window2D _window; }; } // namespace coco diff --git a/contrib/coco/core/src/IR/MaxPool2D.test.cpp b/contrib/coco/core/src/IR/MaxPool2D.test.cpp index 718aef5..187e3f8 100644 --- a/contrib/coco/core/src/IR/MaxPool2D.test.cpp +++ b/contrib/coco/core/src/IR/MaxPool2D.test.cpp @@ -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) -- 2.7.4