[coco] Remove deprecated allocate method (#2635)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 12 Dec 2018 07:32:45 +0000 (16:32 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 12 Dec 2018 07:32:45 +0000 (16:32 +0900)
This commit removes (deprecated) allocate method which takes "object"
as an argument.

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

index 9f84092..5100e9d 100644 (file)
@@ -48,8 +48,6 @@ template <typename T> struct PlainWeightContext
    *   assert(span.size() == bag->size());
    */
   virtual Span<T> allocate(const Bag *) = 0;
-  // WARN Depercated
-  virtual void allocate(const KernelObject *) = 0;
 
   /**
    * @brief Return a pointer to the underlying storage
index 557666d..57d3277 100644 (file)
@@ -129,15 +129,6 @@ public:
     return weight(bag);
   }
 
-  void allocate(const coco::KernelObject *obj) override
-  {
-    assert(obj != nullptr);
-    auto bag = obj->bag();
-    assert(bag != nullptr);
-
-    _blob->allocate(bag, sizeof(T));
-  }
-
   coco::Span<T> weight(const coco::Bag *b) override
   {
     // TODO Check type later
index 6cd54b0..1029dfe 100644 (file)
@@ -62,80 +62,3 @@ TEST(IR_DATA, allocate_and_link_bag)
     ASSERT_EQ(allocated_span.size(), retrieved_span.size());
   }
 }
-
-TEST(IR_DATA, allocate_and_link_kernel)
-{
-  using nncc::core::ADT::kernel::num_elements;
-
-  // Create a kernel object
-  auto module = coco::Module::create();
-
-  const nncc::core::ADT::kernel::Shape shape{1, 1, 3, 3};
-  auto bag = module->entity()->bag()->create(9);
-  auto obj = module->entity()->object()->create<coco::KernelObject>();
-
-  obj->bag(bag);
-  obj->layout(coco::KernelLayouts::NHWC::create(shape));
-
-  auto data = coco::Data::create();
-
-  // weight(...) SHOULD return a null-span for an invalid bag
-  {
-    auto span = data->f32()->weight(bag);
-
-    ASSERT_EQ(span.data(), nullptr);
-    ASSERT_EQ(span.size(), 0);
-  }
-
-  // Create a blob and link it with kernel object
-  data->f32()->allocate(obj);
-
-  // weight(...) SHOULD return a valid for a valid bag
-  {
-    auto span = data->f32()->weight(bag);
-
-    ASSERT_NE(span.data(), nullptr);
-    ASSERT_EQ(span.size(), bag->size());
-  }
-
-  auto reader = data->f32()->read(obj);
-  auto accessor = data->f32()->access(obj);
-
-  ASSERT_TRUE(data->allocated(bag));
-
-  static nncc::core::ADT::kernel::NCHWLayout l{};
-
-  // Check wheter blob is zero-initialized, and updates its value
-  for (uint32_t n = 0; n < shape.count(); ++n)
-  {
-    for (uint32_t ch = 0; ch < shape.depth(); ++ch)
-    {
-      for (uint32_t row = 0; row < shape.height(); ++row)
-      {
-        for (uint32_t col = 0; col < shape.width(); ++col)
-        {
-          EXPECT_FLOAT_EQ(reader->at(n, ch, row, col), 0.0f);
-          accessor->at(n, ch, row, col) = l.offset(shape, n, ch, row, col);
-        }
-      }
-    }
-  }
-
-  // Check wheter accessor behaves as expected
-  for (uint32_t n = 0; n < shape.count(); ++n)
-  {
-    for (uint32_t ch = 0; ch < shape.depth(); ++ch)
-    {
-      for (uint32_t row = 0; row < shape.height(); ++row)
-      {
-        for (uint32_t col = 0; col < shape.width(); ++col)
-        {
-          EXPECT_FLOAT_EQ(reader->at(n, ch, row, col), l.offset(shape, n, ch, row, col));
-        }
-      }
-    }
-  }
-
-  data->release(bag);
-  ASSERT_FALSE(data->allocated(bag));
-}