From: 오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 Date: Fri, 15 Feb 2019 02:21:54 +0000 (+0900) Subject: Rename utils for NNAPI to internal converters (#4429) X-Git-Tag: submit/tizen/20190325.013700~250 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=926b356d9fa467436a9a354a819e1051330b51de;p=platform%2Fcore%2Fml%2Fnnfw.git 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 --- 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__