From 1f1ce45087be4773183713fe3853776917ca3fa9 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, 11 Dec 2018 09:16:56 +0900 Subject: [PATCH] [coco] Create BHWC FeatureLayout with FeatureShape (#2593) This change allows users to create a BHWC FeatureLayout with non-singular batch dimension. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/FeatureLayouts.h | 1 + contrib/coco/core/src/IR/FeatureLayouts.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/contrib/coco/core/include/coco/IR/FeatureLayouts.h b/contrib/coco/core/include/coco/IR/FeatureLayouts.h index 8764f26..23b9c49 100644 --- a/contrib/coco/core/include/coco/IR/FeatureLayouts.h +++ b/contrib/coco/core/include/coco/IR/FeatureLayouts.h @@ -79,6 +79,7 @@ private: public: static std::unique_ptr create(const nncc::core::ADT::feature::Shape &shape); + static std::unique_ptr create(const FeatureShape &shape); }; /** diff --git a/contrib/coco/core/src/IR/FeatureLayouts.cpp b/contrib/coco/core/src/IR/FeatureLayouts.cpp index fde4b84..f4cfb96 100644 --- a/contrib/coco/core/src/IR/FeatureLayouts.cpp +++ b/contrib/coco/core/src/IR/FeatureLayouts.cpp @@ -93,6 +93,12 @@ std::unique_ptr BHWC::create(const nncc::core::ADT::feature::Shape &shape) return std::unique_ptr{new BHWC{FeatureShape{shape}}}; } +std::unique_ptr BHWC::create(const FeatureShape &shape) +{ + // NOTE It is impossible to use make_unique here as the constructor is private + return std::unique_ptr{new BHWC{shape}}; +} + } // namespace FeatureLayouts } // namespace coco -- 2.7.4