From 6c835c20e7b70127f7e3da28caec5db1f5fb134f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=EC=83=81=EA=B7=9C/On-Device=20Lab=28SR=29/Princip?= =?utf8?q?al=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 19 Nov 2019 18:20:32 +0900 Subject: [PATCH] [nnpkg-run] remove tensor_dumper not used any longer (#9025) It removes tensor_dumper.{h,cc}, which are not used any longer. Signed-off-by: Sanggyu Lee --- tests/tools/nnpackage_run/CMakeLists.txt | 1 - tests/tools/nnpackage_run/src/nnpackage_run.cc | 1 - tests/tools/nnpackage_run/src/tensor_dumper.cc | 54 -------------------------- tests/tools/nnpackage_run/src/tensor_dumper.h | 47 ---------------------- 4 files changed, 103 deletions(-) delete mode 100644 tests/tools/nnpackage_run/src/tensor_dumper.cc delete mode 100644 tests/tools/nnpackage_run/src/tensor_dumper.h diff --git a/tests/tools/nnpackage_run/CMakeLists.txt b/tests/tools/nnpackage_run/CMakeLists.txt index fbb2284..ff134a4 100644 --- a/tests/tools/nnpackage_run/CMakeLists.txt +++ b/tests/tools/nnpackage_run/CMakeLists.txt @@ -17,7 +17,6 @@ list(APPEND HDF5_CXX_LIBRARIES aec) list(APPEND NNPACKAGE_RUN_SRCS "src/nnpackage_run.cc") list(APPEND NNPACKAGE_RUN_SRCS "src/args.cc") -list(APPEND NNPACKAGE_RUN_SRCS "src/tensor_dumper.cc") nnas_find_package(Boost REQUIRED) diff --git a/tests/tools/nnpackage_run/src/nnpackage_run.cc b/tests/tools/nnpackage_run/src/nnpackage_run.cc index 5442898..9a718bd 100644 --- a/tests/tools/nnpackage_run/src/nnpackage_run.cc +++ b/tests/tools/nnpackage_run/src/nnpackage_run.cc @@ -16,7 +16,6 @@ #include "args.h" #include "tflite/Diff.h" -#include "tensor_dumper.h" #include "nnfw.h" #include diff --git a/tests/tools/nnpackage_run/src/tensor_dumper.cc b/tests/tools/nnpackage_run/src/tensor_dumper.cc deleted file mode 100644 index ae4ed95..0000000 --- a/tests/tools/nnpackage_run/src/tensor_dumper.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "tensor_dumper.h" - -#include -#include -#include - -namespace NNPackageRun -{ -TensorDumper::TensorDumper(const std::string &filename) -{ - // TODO Handle file open/write error - file_.open(filename, std::ios::out | std::ios::binary); - dumpInt32(version); -} - -TensorDumper::~TensorDumper() { file_.close(); } - -void TensorDumper::dumpInt32(int32_t i) -{ - file_.write(reinterpret_cast(&i), sizeof(i)); -} - -void TensorDumper::dumpSizeT(size_t i) -{ - file_.write(reinterpret_cast(&i), sizeof(i)); -} - -void TensorDumper::dumpTensor(const nnfw_tensorinfo ti, void *buffer, size_t bytes) -{ - dumpInt32(ti.dtype); - dumpInt32(ti.rank); - for (uint i = 0; i < ti.rank; ++i) - dumpInt32(ti.dims[i]); - dumpSizeT(bytes); - file_.write(static_cast(buffer), bytes); -} - -} // end of namespace NNPackageRun \ No newline at end of file diff --git a/tests/tools/nnpackage_run/src/tensor_dumper.h b/tests/tools/nnpackage_run/src/tensor_dumper.h deleted file mode 100644 index 12cc22f..0000000 --- a/tests/tools/nnpackage_run/src/tensor_dumper.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __NNPACKAGE_RUN_TENSOR_DUMPER_H__ -#define __NNPACKAGE_RUN_TENSOR_DUMPER_H__ - -#include -#include -#include -#include -#include - -#include "nnfw.h" - -namespace NNPackageRun -{ - -class TensorDumper -{ -public: - TensorDumper(const std::string &filename); - void dumpTensor(const nnfw_tensorinfo ti, void *buffer, size_t bytes); - void dumpInt32(int32_t i); - void dumpSizeT(size_t i); - ~TensorDumper(); - -private: - static constexpr int version = 1; - std::ofstream file_; -}; - -} // end of namespace NNPackageRun - -#endif // __NNPACKAGE_RUN_TENSOR_DUMPER_H__ -- 2.7.4