[neurun] Fix `TensorInfo::total_size` (#4321)
author이한종/On-Device Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Mon, 28 Jan 2019 00:40:58 +0000 (09:40 +0900)
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Mon, 28 Jan 2019 00:40:58 +0000 (09:40 +0900)
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 <hanjoung.lee@samsung.com>
runtimes/neurun/src/compiler/TensorInfo.h

index 787c433..3decb1f 100644 (file)
@@ -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<size_t>());
+    return std::accumulate(dims.begin(), dims.end(), sizeOfDataType(_typeInfo.type()),
+                           std::multiplies<size_t>());
   }
 
 private: