[coco] Create BHWC FeatureLayout with FeatureShape (#2593)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 11 Dec 2018 00:16:56 +0000 (09:16 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 11 Dec 2018 00:16:56 +0000 (09:16 +0900)
This change allows users to create a BHWC FeatureLayout with non-singular
batch dimension.

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

index 8764f26..23b9c49 100644 (file)
@@ -79,6 +79,7 @@ private:
 
 public:
   static std::unique_ptr<BHWC> create(const nncc::core::ADT::feature::Shape &shape);
+  static std::unique_ptr<BHWC> create(const FeatureShape &shape);
 };
 
 /**
index fde4b84..f4cfb96 100644 (file)
@@ -93,6 +93,12 @@ std::unique_ptr<BHWC> BHWC::create(const nncc::core::ADT::feature::Shape &shape)
   return std::unique_ptr<BHWC>{new BHWC{FeatureShape{shape}}};
 }
 
+std::unique_ptr<BHWC> BHWC::create(const FeatureShape &shape)
+{
+  // NOTE It is impossible to use make_unique here as the constructor is private
+  return std::unique_ptr<BHWC>{new BHWC{shape}};
+}
+
 } // namespace FeatureLayouts
 } // namespace coco