Fix tflite_run tensor loader bug (#4533)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Thu, 28 Feb 2019 04:40:29 +0000 (13:40 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 28 Feb 2019 04:40:29 +0000 (13:40 +0900)
Fix tflite_run tensor loader's raw data pointer type: unique_ptr of array

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
tests/tools/tflite_run/src/tensor_loader.cc
tests/tools/tflite_run/src/tensor_loader.h

index 934b78f..b105005 100644 (file)
@@ -28,7 +28,7 @@ void TensorLoader::load(const std::string &filename)
   file.read(reinterpret_cast<char *>(tensor_indices_raw), sizeof(tensor_indices_raw));
   std::vector<int> tensor_indices(tensor_indices_raw, tensor_indices_raw + num_tensors);
 
-  _raw_data = std::unique_ptr<float>(new float[file_size]);
+  _raw_data = std::unique_ptr<float[]>(new float[file_size]);
   file.read(reinterpret_cast<char *>(_raw_data.get()), file_size);
 
   size_t offset = 0;
index fc4a37a..7b46a1a 100644 (file)
@@ -26,7 +26,7 @@ public:
 
 private:
   tflite::Interpreter &_interpreter;
-  std::unique_ptr<float> _raw_data;
+  std::unique_ptr<float[]> _raw_data;
   std::unordered_map<int, nnfw::tflite::TensorView<float>> _tensor_map;
 };