From: 이한종/On-Device Lab(SR)/Engineer/삼성전자 Date: Mon, 28 Jan 2019 00:40:58 +0000 (+0900) Subject: [neurun] Fix `TensorInfo::total_size` (#4321) X-Git-Tag: submit/tizen/20190325.013700~308 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=353dfa998bb2454b2d0b3bed3a404d3bd0ccc300;p=platform%2Fcore%2Fml%2Fnnfw.git [neurun] Fix `TensorInfo::total_size` (#4321) Fix calculation of total size for a tensor to use actual element size. Before it assumed the element size of 4. Signed-off-by: Hanjoung Lee --- diff --git a/runtimes/neurun/src/compiler/TensorInfo.h b/runtimes/neurun/src/compiler/TensorInfo.h index 787c433..3decb1f 100644 --- a/runtimes/neurun/src/compiler/TensorInfo.h +++ b/runtimes/neurun/src/compiler/TensorInfo.h @@ -46,7 +46,8 @@ public: size_t total_size() const { const auto &dims = _shape.dims(); - return std::accumulate(dims.begin(), dims.end(), 4, std::multiplies()); + return std::accumulate(dims.begin(), dims.end(), sizeOfDataType(_typeInfo.type()), + std::multiplies()); } private: