From fb0d61c32444b65bbefd4f9083ccbac0225b5984 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: Thu, 21 Mar 2019 10:25:00 +0900 Subject: [PATCH] Rename reduce max operation (#4806) Rename NNAPI Ex operation for reduce max TENSORFLOW_MAX_EX -> REDUCE_MAX_EX Update NeuralNetworksEx.h comment Signed-off-by: Hyeongseok Oh --- include/NeuralNetworksEx.h | 5 +++-- libs/tflite/src/ext/nnapi_delegate.cpp | 4 ++-- runtimes/neurun/frontend/nnapi/wrapper/OperationFactory.cc | 2 +- runtimes/pure_arm_compute/src/model.cc | 2 +- tests/nnapi/nnapi_gtest.skip.armv7l-linux.neurun.cpu | 2 +- tests/nnapi/nnapi_gtest.skip.x86_64-linux.neurun | 2 +- ...ensorflowmax_ex_2D_float.mod.py => reduce_max_ex_2D_float.mod.py} | 2 +- ...ensorflowmax_ex_2D_int32.mod.py => reduce_max_ex_2D_int32.mod.py} | 2 +- ...at_reducing_C.mod.py => reduce_max_ex_4D_float_reducing_C.mod.py} | 2 +- ..._reducing_HW.mod.py => reduce_max_ex_4D_float_reducing_HW.mod.py} | 2 +- .../Ex/{tensorflowmax_ex_float.mod.py => reduce_max_ex_float.mod.py} | 2 +- ...{tensorflowmax_ex_float_1.mod.py => reduce_max_ex_float_1.mod.py} | 2 +- ...{tensorflowmax_ex_float_2.mod.py => reduce_max_ex_float_2.mod.py} | 2 +- ...ensorflowmax_ex_quant8_1.mod.py => reduce_max_ex_quant8_1.mod.py} | 2 +- ...ensorflowmax_ex_quant8_2.mod.py => reduce_max_ex_quant8_2.mod.py} | 2 +- 15 files changed, 18 insertions(+), 17 deletions(-) rename tests/nnapi/specs/Ex/{tensorflowmax_ex_2D_float.mod.py => reduce_max_ex_2D_float.mod.py} (87%) rename tests/nnapi/specs/Ex/{tensorflowmax_ex_2D_int32.mod.py => reduce_max_ex_2D_int32.mod.py} (86%) rename tests/nnapi/specs/Ex/{tensorflowmax_ex_4D_float_reducing_C.mod.py => reduce_max_ex_4D_float_reducing_C.mod.py} (93%) rename tests/nnapi/specs/Ex/{tensorflowmax_ex_4D_float_reducing_HW.mod.py => reduce_max_ex_4D_float_reducing_HW.mod.py} (94%) rename tests/nnapi/specs/Ex/{tensorflowmax_ex_float.mod.py => reduce_max_ex_float.mod.py} (85%) rename tests/nnapi/specs/Ex/{tensorflowmax_ex_float_1.mod.py => reduce_max_ex_float_1.mod.py} (88%) rename tests/nnapi/specs/Ex/{tensorflowmax_ex_float_2.mod.py => reduce_max_ex_float_2.mod.py} (88%) rename tests/nnapi/specs/Ex/{tensorflowmax_ex_quant8_1.mod.py => reduce_max_ex_quant8_1.mod.py} (88%) rename tests/nnapi/specs/Ex/{tensorflowmax_ex_quant8_2.mod.py => reduce_max_ex_quant8_2.mod.py} (88%) diff --git a/include/NeuralNetworksEx.h b/include/NeuralNetworksEx.h index e7194e7..2ec0f06 100644 --- a/include/NeuralNetworksEx.h +++ b/include/NeuralNetworksEx.h @@ -18,7 +18,8 @@ /** * @file NeuralNetworksEx.h * @brief This file contains ANeuralNetworksModel_addOperationEx function definition - * @ingroup COM_AI_RUNTIME + * @note This header describes experimental feature, + * so specification here can be changed or/and removed */ #ifndef NN_RUNTIME_NEURAL_NETWORKS_EX_H #define NN_RUNTIME_NEURAL_NETWORKS_EX_H @@ -141,7 +142,7 @@ typedef enum { * Outputs: * * 0: A tensor of the same {@link OperandCode} as input0. */ - ANEURALNETWORKS_TENSORFLOW_MAX_EX = 50003, + ANEURALNETWORKS_REDUCE_MAX_EX = 50003, /** * Splits a tensor along a given axis into num_splits subtensors. diff --git a/libs/tflite/src/ext/nnapi_delegate.cpp b/libs/tflite/src/ext/nnapi_delegate.cpp index 78c3fed..2aaa952 100644 --- a/libs/tflite/src/ext/nnapi_delegate.cpp +++ b/libs/tflite/src/ext/nnapi_delegate.cpp @@ -821,7 +821,7 @@ TfLiteStatus AddOpsAndParams( continue; case tflite::BuiltinOperator_REDUCE_MAX: CHECK_NN(ANeuralNetworksModel_addOperationEx( - nn_model, ANEURALNETWORKS_TENSORFLOW_MAX_EX, + nn_model, ANEURALNETWORKS_REDUCE_MAX_EX, static_cast(augmented_inputs.size()), augmented_inputs.data(), static_cast(node.outputs->size), @@ -936,7 +936,7 @@ TfLiteStatus AddOpsAndParams( std::string custom_name(registration.custom_name); if (custom_name.compare("TensorFlowMax") == 0) { CHECK_NN(ANeuralNetworksModel_addOperationEx( - nn_model, ANEURALNETWORKS_TENSORFLOW_MAX_EX, + nn_model, ANEURALNETWORKS_REDUCE_MAX_EX, static_cast(augmented_inputs.size()), augmented_inputs.data(), static_cast(node.outputs->size), diff --git a/runtimes/neurun/frontend/nnapi/wrapper/OperationFactory.cc b/runtimes/neurun/frontend/nnapi/wrapper/OperationFactory.cc index f238927..f491198 100644 --- a/runtimes/neurun/frontend/nnapi/wrapper/OperationFactory.cc +++ b/runtimes/neurun/frontend/nnapi/wrapper/OperationFactory.cc @@ -585,7 +585,7 @@ OperationFactory::OperationFactory() return new operation::ExpNode{inputs, outputs}; }; - _map[ANEURALNETWORKS_TENSORFLOW_MAX_EX] = [](const OperationFactory::Param &init_param) { + _map[ANEURALNETWORKS_REDUCE_MAX_EX] = [](const OperationFactory::Param &init_param) { assert(init_param.input_count == 2 && init_param.output_count == 1); operand::IndexSet outputs{init_param.outputs[0]}; diff --git a/runtimes/pure_arm_compute/src/model.cc b/runtimes/pure_arm_compute/src/model.cc index dcb8db8..ddca589 100644 --- a/runtimes/pure_arm_compute/src/model.cc +++ b/runtimes/pure_arm_compute/src/model.cc @@ -763,7 +763,7 @@ int ANeuralNetworksModel_addOperationEx(ANeuralNetworksModel *model, break; } - case ANEURALNETWORKS_TENSORFLOW_MAX_EX: + case ANEURALNETWORKS_REDUCE_MAX_EX: { using internal::tflite::op::ReduceMax::Param; using internal::tflite::op::ReduceMax::Node; diff --git a/tests/nnapi/nnapi_gtest.skip.armv7l-linux.neurun.cpu b/tests/nnapi/nnapi_gtest.skip.armv7l-linux.neurun.cpu index a6ce26c..3fb6ae1 100644 --- a/tests/nnapi/nnapi_gtest.skip.armv7l-linux.neurun.cpu +++ b/tests/nnapi/nnapi_gtest.skip.armv7l-linux.neurun.cpu @@ -70,7 +70,7 @@ GeneratedTests.transpose* GeneratedTests.cast_ex* GeneratedTests.gather_ex* GeneratedTests.strided_slice_ex* -GeneratedTests.tensorflowmax_ex* +GeneratedTests.reduce_max_ex* GeneratedTests.reduce_sum_ex* GeneratedTests.topk_v2* # Unexpected result diff --git a/tests/nnapi/nnapi_gtest.skip.x86_64-linux.neurun b/tests/nnapi/nnapi_gtest.skip.x86_64-linux.neurun index 59957ba..4eed396 100644 --- a/tests/nnapi/nnapi_gtest.skip.x86_64-linux.neurun +++ b/tests/nnapi/nnapi_gtest.skip.x86_64-linux.neurun @@ -98,7 +98,7 @@ GeneratedTests.transpose* GeneratedTests.cast_ex* GeneratedTests.gather_ex* GeneratedTests.strided_slice_ex* -GeneratedTests.tensorflowmax_ex* +GeneratedTests.reduce_max_ex* GeneratedTests.reduce_sum_ex* GeneratedTests.topk_v2* # Unhandled exception diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_2D_float.mod.py b/tests/nnapi/specs/Ex/reduce_max_ex_2D_float.mod.py similarity index 87% rename from tests/nnapi/specs/Ex/tensorflowmax_ex_2D_float.mod.py rename to tests/nnapi/specs/Ex/reduce_max_ex_2D_float.mod.py index 6cf8d83..5df76cb 100644 --- a/tests/nnapi/specs/Ex/tensorflowmax_ex_2D_float.mod.py +++ b/tests/nnapi/specs/Ex/reduce_max_ex_2D_float.mod.py @@ -3,7 +3,7 @@ model = Model() i1 = Input("input", "TENSOR_FLOAT32", "{3, 4}") axis = Int32Scalar("axis", 1) out1 = Output("output", "TENSOR_FLOAT32", "{3}") -model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(out1) +model = model.Operation("REDUCE_MAX_EX", i1, axis).To(out1) # Example 1. Input in operand 0, 1 input0 = {i1: # input 0 diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_2D_int32.mod.py b/tests/nnapi/specs/Ex/reduce_max_ex_2D_int32.mod.py similarity index 86% rename from tests/nnapi/specs/Ex/tensorflowmax_ex_2D_int32.mod.py rename to tests/nnapi/specs/Ex/reduce_max_ex_2D_int32.mod.py index 940dab3..94e9526 100644 --- a/tests/nnapi/specs/Ex/tensorflowmax_ex_2D_int32.mod.py +++ b/tests/nnapi/specs/Ex/reduce_max_ex_2D_int32.mod.py @@ -3,7 +3,7 @@ model = Model() i1 = Input("input", "TENSOR_INT32", "{3, 4}") axis = Int32Scalar("axis", 1) out1 = Output("output", "TENSOR_INT32", "{3}") -model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(out1) +model = model.Operation("REDUCE_MAX_EX", i1, axis).To(out1) # Example 1. Input in operand 0, 1 input0 = {i1: # input 0 diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_C.mod.py b/tests/nnapi/specs/Ex/reduce_max_ex_4D_float_reducing_C.mod.py similarity index 93% rename from tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_C.mod.py rename to tests/nnapi/specs/Ex/reduce_max_ex_4D_float_reducing_C.mod.py index 82a5dbb..4143b4b 100644 --- a/tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_C.mod.py +++ b/tests/nnapi/specs/Ex/reduce_max_ex_4D_float_reducing_C.mod.py @@ -21,7 +21,7 @@ i1 = Input("input", "TENSOR_FLOAT32", "{%d, %d, %d, %d}" % (batch, rows, cols, d axis = Parameter("axis", "TENSOR_INT32", "{2}", [3, -1]) output = Output("output", "TENSOR_FLOAT32", "{%d, %d, %d}" % (batch, rows, cols)) -model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) +model = model.Operation("REDUCE_MAX_EX", i1, axis).To(output) # Example 1. Input in operand 0, input0 = {i1: # input 0 diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_HW.mod.py b/tests/nnapi/specs/Ex/reduce_max_ex_4D_float_reducing_HW.mod.py similarity index 94% rename from tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_HW.mod.py rename to tests/nnapi/specs/Ex/reduce_max_ex_4D_float_reducing_HW.mod.py index a127620..e220df7 100644 --- a/tests/nnapi/specs/Ex/tensorflowmax_ex_4D_float_reducing_HW.mod.py +++ b/tests/nnapi/specs/Ex/reduce_max_ex_4D_float_reducing_HW.mod.py @@ -21,7 +21,7 @@ i1 = Input("input", "TENSOR_FLOAT32", "{%d, %d, %d, %d}" % (batch, rows, cols, d axis = Parameter("axis", "TENSOR_INT32", "{4}", [1, 2, -3, -2]) output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (batch, depth)) -model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) +model = model.Operation("REDUCE_MAX_EX", i1, axis).To(output) # Example 1. Input in operand 0, input0 = {i1: # input 0 diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_float.mod.py b/tests/nnapi/specs/Ex/reduce_max_ex_float.mod.py similarity index 85% rename from tests/nnapi/specs/Ex/tensorflowmax_ex_float.mod.py rename to tests/nnapi/specs/Ex/reduce_max_ex_float.mod.py index 6de2207..c6387ae 100644 --- a/tests/nnapi/specs/Ex/tensorflowmax_ex_float.mod.py +++ b/tests/nnapi/specs/Ex/reduce_max_ex_float.mod.py @@ -3,7 +3,7 @@ i1 = Input("input", "TENSOR_FLOAT32", "{1, 2, 2, 1}") axis = Parameter("axis", "TENSOR_INT32", "{1}", [2]) output = Output("output", "TENSOR_FLOAT32", "{1, 2, 1}") -model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) +model = model.Operation("REDUCE_MAX_EX", i1, axis).To(output) # Example 1. Input in operand 0, input0 = {i1: # input 0 diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_float_1.mod.py b/tests/nnapi/specs/Ex/reduce_max_ex_float_1.mod.py similarity index 88% rename from tests/nnapi/specs/Ex/tensorflowmax_ex_float_1.mod.py rename to tests/nnapi/specs/Ex/reduce_max_ex_float_1.mod.py index 42dc9d9..7871c61 100644 --- a/tests/nnapi/specs/Ex/tensorflowmax_ex_float_1.mod.py +++ b/tests/nnapi/specs/Ex/reduce_max_ex_float_1.mod.py @@ -3,7 +3,7 @@ i1 = Input("input", "TENSOR_FLOAT32", "{4, 3, 2}") axis = Parameter("axis", "TENSOR_INT32", "{4}", [1, 0, -3, -3]) output = Output("output", "TENSOR_FLOAT32", "{2}") -model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) +model = model.Operation("REDUCE_MAX_EX", i1, axis).To(output) # Example 1. Input in operand 0, input0 = {i1: # input 0 diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_float_2.mod.py b/tests/nnapi/specs/Ex/reduce_max_ex_float_2.mod.py similarity index 88% rename from tests/nnapi/specs/Ex/tensorflowmax_ex_float_2.mod.py rename to tests/nnapi/specs/Ex/reduce_max_ex_float_2.mod.py index 98c0d9d..fb523b2 100644 --- a/tests/nnapi/specs/Ex/tensorflowmax_ex_float_2.mod.py +++ b/tests/nnapi/specs/Ex/reduce_max_ex_float_2.mod.py @@ -3,7 +3,7 @@ i1 = Input("input", "TENSOR_FLOAT32", "{4, 3, 2}") axis = Parameter("axis", "TENSOR_INT32", "{2}", [0, 2]) output = Output("output", "TENSOR_FLOAT32", "{1, 3, 1}") -model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) +model = model.Operation("REDUCE_MAX_EX", i1, axis).To(output) # Example 1. Input in operand 0, input0 = {i1: # input 0 diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_1.mod.py b/tests/nnapi/specs/Ex/reduce_max_ex_quant8_1.mod.py similarity index 88% rename from tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_1.mod.py rename to tests/nnapi/specs/Ex/reduce_max_ex_quant8_1.mod.py index 8e85633..9cef1de 100644 --- a/tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_1.mod.py +++ b/tests/nnapi/specs/Ex/reduce_max_ex_quant8_1.mod.py @@ -3,7 +3,7 @@ i1 = Input("input", "TENSOR_QUANT8_ASYMM", "{4, 3, 2}, 0.8, 5") axis = Parameter("axis", "TENSOR_INT32", "{4}", [1, 0, -3, -3]) output = Output("output", "TENSOR_QUANT8_ASYMM", "{2}, 0.8, 5") -model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) +model = model.Operation("REDUCE_MAX_EX", i1, axis).To(output) # Example 1. Input in operand 0, input0 = {i1: # input 0 diff --git a/tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_2.mod.py b/tests/nnapi/specs/Ex/reduce_max_ex_quant8_2.mod.py similarity index 88% rename from tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_2.mod.py rename to tests/nnapi/specs/Ex/reduce_max_ex_quant8_2.mod.py index 75138b1..d59c11b 100644 --- a/tests/nnapi/specs/Ex/tensorflowmax_ex_quant8_2.mod.py +++ b/tests/nnapi/specs/Ex/reduce_max_ex_quant8_2.mod.py @@ -3,7 +3,7 @@ i1 = Input("input", "TENSOR_QUANT8_ASYMM", "{4, 3, 2}, 0.8, 5") axis = Parameter("axis", "TENSOR_INT32", "{2}", [0, 2]) output = Output("output", "TENSOR_QUANT8_ASYMM", "{1, 3, 1}, 0.8, 5") -model = model.Operation("TENSORFLOW_MAX_EX", i1, axis).To(output) +model = model.Operation("REDUCE_MAX_EX", i1, axis).To(output) # Example 1. Input in operand 0, input0 = {i1: # input 0 -- 2.7.4