From: 박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Wed, 31 Oct 2018 01:46:45 +0000 (+0900) Subject: [coco] Fix a bug in BC FeatureLayout test (#2049) X-Git-Tag: nncc_backup~1445 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7cb0a3f29c1513f4b0f5091fc76af2d198014979;p=platform%2Fcore%2Fml%2Fnnfw.git [coco] Fix a bug in BC FeatureLayout test (#2049) The current test uses invalid 'batch' value. Signed-off-by: Jonghyun Park --- diff --git a/contrib/coco/core/src/IR/FeatureLayouts.cpp b/contrib/coco/core/src/IR/FeatureLayouts.cpp index d688c24..570621f 100644 --- a/contrib/coco/core/src/IR/FeatureLayouts.cpp +++ b/contrib/coco/core/src/IR/FeatureLayouts.cpp @@ -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(); diff --git a/contrib/coco/core/src/IR/FeatureLayouts.test.cpp b/contrib/coco/core/src/IR/FeatureLayouts.test.cpp index 18a0f3d..0233396 100644 --- a/contrib/coco/core/src/IR/FeatureLayouts.test.cpp +++ b/contrib/coco/core/src/IR/FeatureLayouts.test.cpp @@ -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) {