From d8d738e01732c969b6b31a5b3d4df481ec057bd8 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: Thu, 30 Aug 2018 17:49:14 +0900 Subject: [PATCH] [coco] Support stride get/set for Conv2D (#1252) This commit allows us to get and set stride values for Conv2D operation. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/Conv2D.h | 6 ++++++ contrib/coco/core/src/IR/Conv2D.test.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/contrib/coco/core/include/coco/IR/Conv2D.h b/contrib/coco/core/include/coco/IR/Conv2D.h index b1802ca..0d7dbb1 100644 --- a/contrib/coco/core/include/coco/IR/Conv2D.h +++ b/contrib/coco/core/include/coco/IR/Conv2D.h @@ -4,6 +4,7 @@ #include "coco/IR/Op.h" #include "coco/IR/KernelObject.h" #include "coco/IR/Padding2D.h" +#include "coco/IR/Stride2D.h" #include "coco/IR/UseSlot.h" namespace coco @@ -41,6 +42,10 @@ public: Padding2D *pad(void) { return &_pad; } const Padding2D *pad(void) const { return &_pad; } +public: + Stride2D *stride(void) { return &_stride; } + const Stride2D *stride(void) const { return &_stride; } + private: const PtrLink *const _op_link; @@ -49,6 +54,7 @@ private: private: Padding2D _pad; + Stride2D _stride; }; } // namespace coco diff --git a/contrib/coco/core/src/IR/Conv2D.test.cpp b/contrib/coco/core/src/IR/Conv2D.test.cpp index 68e2048..54f218a 100644 --- a/contrib/coco/core/src/IR/Conv2D.test.cpp +++ b/contrib/coco/core/src/IR/Conv2D.test.cpp @@ -54,6 +54,10 @@ TEST_F(Conv2DTest, ctor) ASSERT_EQ(op->pad()->bottom(), 0); ASSERT_EQ(op->pad()->left(), 0); ASSERT_EQ(op->pad()->right(), 0); + + ASSERT_NE(op->stride(), nullptr); + ASSERT_EQ(op->stride()->vertical(), 1); + ASSERT_EQ(op->stride()->horizontal(), 1); } TEST_F(Conv2DTest, asConv2D) -- 2.7.4