This commit adds 'num_elements' for feature shape similarly as 'num_elements'
for tensor shape.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
uint32_t _width;
};
+inline uint64_t num_elements(const Shape &shape)
+{
+ return shape.depth() * shape.height() * shape.width();
+}
+
} // namespace feature
} // namespace ADT
} // namespace core
ASSERT_EQ(shape.height(), H);
ASSERT_EQ(shape.width(), W);
}
+
+TEST(ADT_FEATURE_SHAPE, num_elements)
+{
+ const uint32_t C = 3;
+ const uint32_t H = 4;
+ const uint32_t W = 5;
+
+ using nncc::core::ADT::feature::Shape;
+ using nncc::core::ADT::feature::num_elements;
+
+ ASSERT_EQ(num_elements(Shape{C, H, W}), C * H * W);
+}