From 3ff8e62b235d9a5b495723f2a1492a9c64df92a7 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, 6 Nov 2018 09:46:27 +0900 Subject: [PATCH] [coco] Remove KernelObject create method with shape (#2125) This commit removes deprecated KernelObject "create" method with shape from ObjectManager. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/ObjectManager.h | 1 - contrib/coco/core/src/IR.test.cpp | 2 +- contrib/coco/core/src/IR/Conv2D.test.cpp | 4 ++-- contrib/coco/core/src/IR/Module.test.cpp | 2 +- contrib/coco/core/src/IR/ObjectManager.cpp | 10 ---------- contrib/coco/core/src/IR/ObjectManager.test.cpp | 16 ---------------- 6 files changed, 4 insertions(+), 31 deletions(-) diff --git a/contrib/coco/core/include/coco/IR/ObjectManager.h b/contrib/coco/core/include/coco/IR/ObjectManager.h index 665d8d5..4949c83 100644 --- a/contrib/coco/core/include/coco/IR/ObjectManager.h +++ b/contrib/coco/core/include/coco/IR/ObjectManager.h @@ -37,7 +37,6 @@ public: public: FeatureObject *create(const FeatureShape &shape); - KernelObject *create(const nncc::core::ADT::kernel::Shape &shape); template T *create(void); diff --git a/contrib/coco/core/src/IR.test.cpp b/contrib/coco/core/src/IR.test.cpp index 911a3c0..98d2154 100644 --- a/contrib/coco/core/src/IR.test.cpp +++ b/contrib/coco/core/src/IR.test.cpp @@ -140,7 +140,7 @@ TEST(IR, caffe_conv) ker_layout->reorder(); - auto ker_obj = m->entity()->object()->create(ker_shape); + auto ker_obj = m->entity()->object()->create(); ker_obj->bag(ker_bag); ker_obj->layout(std::move(ker_layout)); diff --git a/contrib/coco/core/src/IR/Conv2D.test.cpp b/contrib/coco/core/src/IR/Conv2D.test.cpp index 930bc99..0cb3af4 100644 --- a/contrib/coco/core/src/IR/Conv2D.test.cpp +++ b/contrib/coco/core/src/IR/Conv2D.test.cpp @@ -101,7 +101,7 @@ struct IsConv2D : public coco::Op::DefaultVisitor TEST_F(Conv2DTest, ker_update) { // Prepare a kernel object for testing - auto obj = obj_mgr.create(nncc::core::ADT::kernel::Shape{1, 1, 3, 3}); + auto obj = obj_mgr.create(); // Test 'Conv2D' class auto op = allocate(); @@ -140,7 +140,7 @@ TEST_F(Conv2DTest, accept) TEST_F(Conv2DTest, destructor) { // Prepare a kernel object for testing - auto obj = obj_mgr.create(nncc::core::ADT::kernel::Shape{1, 1, 3, 3}); + auto obj = obj_mgr.create(); // Create 'Conv2D' op auto op = make_unique(); diff --git a/contrib/coco/core/src/IR/Module.test.cpp b/contrib/coco/core/src/IR/Module.test.cpp index c19c9df..15f8d0f 100644 --- a/contrib/coco/core/src/IR/Module.test.cpp +++ b/contrib/coco/core/src/IR/Module.test.cpp @@ -177,7 +177,7 @@ TEST(IR_Module, create_entites) ASSERT_EQ(entity->bag()->create(1)->module(), m.get()); ASSERT_EQ(entity->object()->create(feature::Shape{1, 2, 3})->module(), m.get()); - ASSERT_EQ(entity->object()->create(kernel::Shape{1, 2, 3, 4})->module(), m.get()); + ASSERT_EQ(entity->object()->create()->module(), m.get()); #define OP(Name) ASSERT_EQ(entity->op()->create()->module(), m.get()); #include "coco/IR/Op.lst" #undef OP diff --git a/contrib/coco/core/src/IR/ObjectManager.cpp b/contrib/coco/core/src/IR/ObjectManager.cpp index eca1240..f923dad 100644 --- a/contrib/coco/core/src/IR/ObjectManager.cpp +++ b/contrib/coco/core/src/IR/ObjectManager.cpp @@ -52,16 +52,6 @@ FeatureObject *ObjectManager::create(const nncc::core::ADT::feature::Shape &shap return take(std::move(feature)); } -KernelObject *ObjectManager::create(const nncc::core::ADT::kernel::Shape &shape) -{ - auto kernel = make_unique(shape); - auto kernel_ptr = kernel.get(); - - modulize(kernel_ptr); - - return take(std::move(kernel)); -} - void ObjectManager::destroy(Object *o) { assert(o->def() == nullptr); diff --git a/contrib/coco/core/src/IR/ObjectManager.test.cpp b/contrib/coco/core/src/IR/ObjectManager.test.cpp index 80ca7e3..78ecfd0 100644 --- a/contrib/coco/core/src/IR/ObjectManager.test.cpp +++ b/contrib/coco/core/src/IR/ObjectManager.test.cpp @@ -35,22 +35,6 @@ TEST(IR_OBJECT_MANAGER, create_feature) ASSERT_EQ(o->shape(), shape); } -TEST(IR_OBJECT_MANAGER, create_kernel) -{ - using nncc::core::ADT::kernel::Shape; - - const Shape shape{1, 1, 3, 3}; - - coco::ObjectManager mgr; - - auto o = mgr.create(shape); - - ASSERT_EQ(o->shape().count(), shape.count()); - ASSERT_EQ(o->shape().depth(), shape.depth()); - ASSERT_EQ(o->shape().height(), shape.height()); - ASSERT_EQ(o->shape().width(), shape.width()); -} - TEST(IR_OBJECT_MANAGER, create_feature_with_template) { coco::ObjectManager mgr; -- 2.7.4