[coco] Fix a bug in BC FeatureLayout test (#2049)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 31 Oct 2018 01:46:45 +0000 (10:46 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 31 Oct 2018 01:46:45 +0000 (10:46 +0900)
The current test uses invalid 'batch' value.

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

index d688c24..570621f 100644 (file)
@@ -115,6 +115,8 @@ const FeatureLayout::ID *BC::uid(void)
 
 ElemID BC::at(uint32_t b, uint32_t ch, uint32_t row, uint32_t col) const
 {
+  assert(b < _batch);
+
   uint32_t offset = 0;
 
   offset += b * _shape.depth();
index 18a0f3d..0233396 100644 (file)
@@ -22,13 +22,16 @@ using namespace nncc::core::ADT;
 
 TEST(FeatureLayoutsTest, BC)
 {
-  const uint32_t B = 2;
+  // NOTE The current implementation uses a hard-coded "batch" value
+  const uint32_t B = 1;
   const uint32_t C = 3;
   const uint32_t H = 4;
   const uint32_t W = 5;
 
   auto l = coco::FeatureLayouts::BC::create(feature::Shape{C, H, W});
 
+  ASSERT_EQ(l->batch(), B);
+
   // Check whether BC layout is actually channel-wise
   for (uint32_t b = 0; b < B; ++b)
   {