Rename utils for NNAPI to internal converters (#4429)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Fri, 15 Feb 2019 02:21:54 +0000 (11:21 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 15 Feb 2019 02:21:54 +0000 (11:21 +0900)
Rename file name from TypeConvert.* to NNAPIConvert.*
Rename util function name of NNAPI frontend struct converters
Update comments

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
runtimes/neurun/src/frontend/model.cc
runtimes/neurun/src/frontend/wrapper/execution.cc
runtimes/neurun/src/frontend/wrapper/model.cc
runtimes/neurun/src/util/NNAPIConvert.cc [moved from runtimes/neurun/src/util/TypeConvert.cc with 77% similarity]
runtimes/neurun/src/util/NNAPIConvert.h [moved from runtimes/neurun/src/util/TypeConvert.h with 75% similarity]

index 7e1571f..c42d45f 100644 (file)
@@ -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)
index 4fb0a6c..c7a3679 100644 (file)
@@ -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)
   {
index 4e1c50b..c9276a5 100644 (file)
@@ -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)
     {
similarity index 77%
rename from runtimes/neurun/src/util/TypeConvert.cc
rename to runtimes/neurun/src/util/NNAPIConvert.cc
index d1b6ddc..6166133 100644 (file)
  * 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<model::operand::DataType>(static_cast<uint32_t>(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);
 
similarity index 75%
rename from runtimes/neurun/src/util/TypeConvert.h
rename to runtimes/neurun/src/util/NNAPIConvert.h
index 070fef5..e863346 100644 (file)
  */
 
 /**
- * @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 <NeuralNetworks.h>
 
@@ -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__