[coco] Deprecate Layout manipulation via KernelObject (#1714)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 2 Oct 2018 04:34:42 +0000 (13:34 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 2 Oct 2018 04:34:42 +0000 (13:34 +0900)
This commit removes layout manipulation methods from KernelObject.

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

index 6dd20c5..bc9d3c0 100644 (file)
@@ -49,17 +49,9 @@ public:
   const nncc::core::ADT::kernel::Shape &shape(void) const;
 
 public:
-  // Deprecated
-  ElemID &at(uint32_t n, uint32_t ch, uint32_t row, uint32_t col);
   ElemID at(uint32_t n, uint32_t ch, uint32_t row, uint32_t col) const;
 
 public:
-  // Deprecated
-  void reorder(const nncc::core::ADT::kernel::Layout &l);
-  // Deprecated
-  template <typename LayoutImpl> void reorder(void) { reorder(LayoutImpl{}); }
-
-public:
   const GenericKernelLayout *layout(void) const { return _layout.get(); }
   void layout(std::unique_ptr<GenericKernelLayout> &&l) { _layout = std::move(l); }
 
index 013d397..1c9dd5d 100644 (file)
@@ -136,10 +136,14 @@ TEST(IR, caffe_conv)
 
     const nncc::core::ADT::kernel::Shape ker_shape{1, 1, 3, 3};
     auto ker_bag = m->entity()->bag()->create(num_elements(ker_shape));
+    auto ker_layout = make_unique<coco::GenericKernelLayout>(ker_shape);
+
+    ker_layout->reorder<NCHWLayout>();
+
     auto ker_obj = m->entity()->object()->create(ker_shape);
 
     ker_obj->bag(ker_bag);
-    ker_obj->reorder<NCHWLayout>();
+    ker_obj->layout(std::move(ker_layout));
 
     const nncc::core::ADT::feature::Shape ofm_shape{1, 1, 1};
     auto ofm_bag = m->entity()->bag()->create(1 * 1 * 1);
index d5d4913..6d12ab5 100644 (file)
@@ -36,16 +36,9 @@ KernelObject::~KernelObject()
 
 const nncc::core::ADT::kernel::Shape &KernelObject::shape(void) const { return _layout->shape(); }
 
-ElemID &KernelObject::at(uint32_t n, uint32_t ch, uint32_t row, uint32_t col)
-{
-  return _layout->at(n, ch, row, col);
-}
-
 ElemID KernelObject::at(uint32_t n, uint32_t ch, uint32_t row, uint32_t col) const
 {
   return _layout->at(n, ch, row, col);
 }
 
-void KernelObject::reorder(const nncc::core::ADT::kernel::Layout &l) { _layout->reorder(l); }
-
 } // namespace coco
index e578f21..f0dff27 100644 (file)
@@ -69,6 +69,8 @@ TEST_F(KernelObjectTest, asKernel)
   ASSERT_EQ(mutable_object->asKernel(), immutable_object->asKernel());
 }
 
+// TODO Rewrite this test as a test for GenericKernelLayout
+#if 0
 TEST_F(KernelObjectTest, at)
 {
   const uint32_t N = 1;
@@ -110,3 +112,4 @@ TEST_F(KernelObjectTest, at)
     }
   }
 }
+#endif