From 926b356d9fa467436a9a354a819e1051330b51de Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 15 Feb 2019 11:21:54 +0900 Subject: [PATCH] Rename utils for NNAPI to internal converters (#4429) Rename file name from TypeConvert.* to NNAPIConvert.* Rename util function name of NNAPI frontend struct converters Update comments Signed-off-by: Hyeongseok Oh --- runtimes/neurun/src/frontend/model.cc | 2 +- runtimes/neurun/src/frontend/wrapper/execution.cc | 4 ++-- runtimes/neurun/src/frontend/wrapper/model.cc | 4 ++-- .../src/util/{TypeConvert.cc => NNAPIConvert.cc} | 10 +++++----- .../neurun/src/util/{TypeConvert.h => NNAPIConvert.h} | 18 +++++++++--------- 5 files changed, 19 insertions(+), 19 deletions(-) rename runtimes/neurun/src/util/{TypeConvert.cc => NNAPIConvert.cc} (77%) rename runtimes/neurun/src/util/{TypeConvert.h => NNAPIConvert.h} (75%) diff --git a/runtimes/neurun/src/frontend/model.cc b/runtimes/neurun/src/frontend/model.cc index 7e1571f..c42d45f 100644 --- a/runtimes/neurun/src/frontend/model.cc +++ b/runtimes/neurun/src/frontend/model.cc @@ -27,7 +27,7 @@ #include "frontend/wrapper/model.h" #include "frontend/wrapper/memory.h" #include "model/operation/Node.Include.h" -#include "util/TypeConvert.h" +#include "util/NNAPIConvert.h" #include "util/logging.h" int ANeuralNetworksModel_create(ANeuralNetworksModel **model) diff --git a/runtimes/neurun/src/frontend/wrapper/execution.cc b/runtimes/neurun/src/frontend/wrapper/execution.cc index 4fb0a6c..c7a3679 100644 --- a/runtimes/neurun/src/frontend/wrapper/execution.cc +++ b/runtimes/neurun/src/frontend/wrapper/execution.cc @@ -1,5 +1,5 @@ #include "execution.h" -#include "util/TypeConvert.h" +#include "util/NNAPIConvert.h" const neurun::model::operand::Index ANeuralNetworksExecution::getInputOperandIndex(int32_t index) { @@ -18,7 +18,7 @@ bool ANeuralNetworksExecution::compareDataType(const ANeuralNetworksOperandType const neurun::model::operand::Index index) { const auto operand_type = _executor->plan().model().operands().at(index).typeInfo(); - const auto typeInfo = ::neurun::util::typeInfoFromOperandType(type); + const auto typeInfo = ::neurun::util::getTypeInfo(type); if (operand_type != typeInfo) { diff --git a/runtimes/neurun/src/frontend/wrapper/model.cc b/runtimes/neurun/src/frontend/wrapper/model.cc index 4e1c50b..c9276a5 100644 --- a/runtimes/neurun/src/frontend/wrapper/model.cc +++ b/runtimes/neurun/src/frontend/wrapper/model.cc @@ -18,7 +18,7 @@ #include "graph/Graph.h" #include "util/logging.h" -#include "util/TypeConvert.h" +#include "util/NNAPIConvert.h" // // ANeuralNetworksModel @@ -34,7 +34,7 @@ bool ANeuralNetworksModel::addOperand(const ANeuralNetworksOperandType *type) no try { ::neurun::model::operand::Shape shape(type->dimensionCount); - auto typeInfo = neurun::util::typeInfoFromOperandType(type); + auto typeInfo = neurun::util::getTypeInfo(type); for (uint32_t axis = 0; axis < type->dimensionCount; ++axis) { diff --git a/runtimes/neurun/src/util/TypeConvert.cc b/runtimes/neurun/src/util/NNAPIConvert.cc similarity index 77% rename from runtimes/neurun/src/util/TypeConvert.cc rename to runtimes/neurun/src/util/NNAPIConvert.cc index d1b6ddc..6166133 100644 --- a/runtimes/neurun/src/util/TypeConvert.cc +++ b/runtimes/neurun/src/util/NNAPIConvert.cc @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "TypeConvert.h" +#include "NNAPIConvert.h" namespace neurun { namespace util { -model::operand::DataType typeFromOperandCode(OperandCode type) +model::operand::DataType getDataType(OperandCode type) { // Now neurun::model::operand::DataType shares the same enum value with OperandCode // in NeuralNetworks.h. @@ -29,13 +29,13 @@ model::operand::DataType typeFromOperandCode(OperandCode type) return static_cast(static_cast(type)); } -const model::operand::TypeInfo typeInfoFromOperandType(const ANeuralNetworksOperandType *type) +const model::operand::TypeInfo getTypeInfo(const ANeuralNetworksOperandType *type) { - return model::operand::TypeInfo(typeFromOperandCode((OperandCode)(type->type)), type->scale, + return model::operand::TypeInfo(getDataType((OperandCode)(type->type)), type->scale, type->zeroPoint); } -const model::operand::Shape shapeFromOperandType(const ANeuralNetworksOperandType *type) +const model::operand::Shape getShape(const ANeuralNetworksOperandType *type) { model::operand::Shape shape(type->dimensionCount); diff --git a/runtimes/neurun/src/util/TypeConvert.h b/runtimes/neurun/src/util/NNAPIConvert.h similarity index 75% rename from runtimes/neurun/src/util/TypeConvert.h rename to runtimes/neurun/src/util/NNAPIConvert.h index 070fef5..e863346 100644 --- a/runtimes/neurun/src/util/TypeConvert.h +++ b/runtimes/neurun/src/util/NNAPIConvert.h @@ -15,12 +15,12 @@ */ /** - * @file TypeConvert.h + * @file NNAPIConvert.h * @brief This file contains convereter(s)\n - * from frontend's data type to neurun's internal data type + * from NNAPI frontend's struct to neurun's internal struct */ -#ifndef __NEURUN_UTIL_TYPE_CONVERT_H__ -#define __NEURUN_UTIL_TYPE_CONVERT_H__ +#ifndef __NEURUN_UTIL_NNAPI_CONVERT_H__ +#define __NEURUN_UTIL_NNAPI_CONVERT_H__ #include @@ -40,23 +40,23 @@ namespace util with OperandCode in NeuralNetworks.h.\n If we don't share same value, we must fix this mapping function. */ -model::operand::DataType typeFromOperandCode(OperandCode type); +model::operand::DataType getDataType(OperandCode type); /** * @brief Convert operand type info from NNAPI to interanl operand type info - * @param[in] type NNAPI;s operand type + * @param[in] type NNAPI's operand type * @return neurun's internal operand type info */ -const model::operand::TypeInfo typeInfoFromOperandType(const ANeuralNetworksOperandType *type); +const model::operand::TypeInfo getTypeInfo(const ANeuralNetworksOperandType *type); /** * @brief Convert operand shape info from NNAPI to internal operand shape * @param[in] type NNAPI's operand type * @return neurun's internal operand shape */ -const model::operand::Shape shapeFromOperandType(const ANeuralNetworksOperandType *type); +const model::operand::Shape getShape(const ANeuralNetworksOperandType *type); } // namespace neurun } // namespace util -#endif // __NEURUN_UTIL_TYPE_CONVERT_H__ +#endif // __NEURUN_UTIL_NNAPI_CONVERT_H__ -- 2.7.4