[Gather Op] add axis to runtime_run_android_nn_test (#1479)
author최성진/동작제어Lab(SR)/Principal Engineer/삼성전자 <lotieye.choi@samsung.com>
Thu, 31 May 2018 11:46:10 +0000 (20:46 +0900)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Thu, 31 May 2018 11:46:10 +0000 (20:46 +0900)
This commit adds axis to runtime_run_android_nn_test.
-axis parameter is added newly.

Signed-off-by: SungJin Choi <lotieye.choi@samsung.com>
13 files changed:
runtimes/tests/neural_networks_test/generated/all_generated_tests.cpp
runtimes/tests/neural_networks_test/generated/models/gather_1D_float.model.cpp
runtimes/tests/neural_networks_test/generated/models/gather_1D_int32.model.cpp
runtimes/tests/neural_networks_test/generated/models/gather_1D_uint8.model.cpp
runtimes/tests/neural_networks_test/generated/models/gather_2D_float.model.cpp
runtimes/tests/neural_networks_test/generated/models/gather_2D_int32.model.cpp
runtimes/tests/neural_networks_test/generated/models/gather_2D_uint8.model.cpp
runtimes/tests/neural_networks_test/specs/Ex/gather_1D_float.mod.py
runtimes/tests/neural_networks_test/specs/Ex/gather_1D_int32.mod.py
runtimes/tests/neural_networks_test/specs/Ex/gather_1D_uint8.mod.py
runtimes/tests/neural_networks_test/specs/Ex/gather_2D_float.mod.py
runtimes/tests/neural_networks_test/specs/Ex/gather_2D_int32.mod.py
runtimes/tests/neural_networks_test/specs/Ex/gather_2D_uint8.mod.py

index c5a72f8..cec0704 100644 (file)
@@ -2297,62 +2297,6 @@ TEST_F(GeneratedTests, gather_1D_uint8) {
             gather_1D_uint8::examples);
 }
 
-namespace topk_v2_1D_int32 {
-std::vector<MixedTypedExample> examples = {
-// Generated topk_v2_1D_int32 test
-#include "generated/examples/topk_v2_1D_int32.example.cpp"
-};
-// Generated model constructor
-#include "generated/models/topk_v2_1D_int32.model.cpp"
-} // namespace topk_v2_1D_int32
-TEST_F(GeneratedTests, topk_v2_1D_int32) {
-    execute(topk_v2_1D_int32::CreateModel,
-            topk_v2_1D_int32::is_ignored,
-            topk_v2_1D_int32::examples);
-}
-
-namespace topk_v2_1D_uint8 {
-std::vector<MixedTypedExample> examples = {
-// Generated topk_v2_1D_uint8 test
-#include "generated/examples/topk_v2_1D_uint8.example.cpp"
-};
-// Generated model constructor
-#include "generated/models/topk_v2_1D_uint8.model.cpp"
-} // namespace topk_v2_1D_uint8
-TEST_F(GeneratedTests, topk_v2_1D_uint8) {
-    execute(topk_v2_1D_uint8::CreateModel,
-            topk_v2_1D_uint8::is_ignored,
-            topk_v2_1D_uint8::examples);
-}
-
-namespace topk_v2_2D_int32 {
-std::vector<MixedTypedExample> examples = {
-// Generated topk_v2_2D_int32 test
-#include "generated/examples/topk_v2_2D_int32.example.cpp"
-};
-// Generated model constructor
-#include "generated/models/topk_v2_2D_int32.model.cpp"
-} // namespace topk_v2_2D_int32
-TEST_F(GeneratedTests, topk_v2_2D_int32) {
-    execute(topk_v2_2D_int32::CreateModel,
-            topk_v2_2D_int32::is_ignored,
-            topk_v2_2D_int32::examples);
-}
-
-namespace topk_v2_2D_uint8 {
-std::vector<MixedTypedExample> examples = {
-// Generated topk_v2_2D_uint8 test
-#include "generated/examples/topk_v2_2D_uint8.example.cpp"
-};
-// Generated model constructor
-#include "generated/models/topk_v2_2D_uint8.model.cpp"
-} // namespace topk_v2_2D_uint8
-TEST_F(GeneratedTests, topk_v2_2D_uint8) {
-    execute(topk_v2_2D_uint8::CreateModel,
-            topk_v2_2D_uint8::is_ignored,
-            topk_v2_2D_uint8::examples);
-}
-
 namespace gather_2D_float {
 std::vector<MixedTypedExample> examples = {
 // Generated gather_2D_float test
@@ -2423,6 +2367,34 @@ TEST_F(GeneratedTests, topk_v2_1D_float) {
             topk_v2_1D_float::examples);
 }
 
+namespace topk_v2_1D_int32 {
+std::vector<MixedTypedExample> examples = {
+// Generated topk_v2_1D_int32 test
+#include "generated/examples/topk_v2_1D_int32.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/topk_v2_1D_int32.model.cpp"
+} // namespace topk_v2_1D_int32
+TEST_F(GeneratedTests, topk_v2_1D_int32) {
+    execute(topk_v2_1D_int32::CreateModel,
+            topk_v2_1D_int32::is_ignored,
+            topk_v2_1D_int32::examples);
+}
+
+namespace topk_v2_1D_uint8 {
+std::vector<MixedTypedExample> examples = {
+// Generated topk_v2_1D_uint8 test
+#include "generated/examples/topk_v2_1D_uint8.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/topk_v2_1D_uint8.model.cpp"
+} // namespace topk_v2_1D_uint8
+TEST_F(GeneratedTests, topk_v2_1D_uint8) {
+    execute(topk_v2_1D_uint8::CreateModel,
+            topk_v2_1D_uint8::is_ignored,
+            topk_v2_1D_uint8::examples);
+}
+
 namespace topk_v2_2D_float {
 std::vector<MixedTypedExample> examples = {
 // Generated topk_v2_2D_float test
@@ -2436,3 +2408,31 @@ TEST_F(GeneratedTests, topk_v2_2D_float) {
             topk_v2_2D_float::is_ignored,
             topk_v2_2D_float::examples);
 }
+
+namespace topk_v2_2D_int32 {
+std::vector<MixedTypedExample> examples = {
+// Generated topk_v2_2D_int32 test
+#include "generated/examples/topk_v2_2D_int32.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/topk_v2_2D_int32.model.cpp"
+} // namespace topk_v2_2D_int32
+TEST_F(GeneratedTests, topk_v2_2D_int32) {
+    execute(topk_v2_2D_int32::CreateModel,
+            topk_v2_2D_int32::is_ignored,
+            topk_v2_2D_int32::examples);
+}
+
+namespace topk_v2_2D_uint8 {
+std::vector<MixedTypedExample> examples = {
+// Generated topk_v2_2D_uint8 test
+#include "generated/examples/topk_v2_2D_uint8.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/topk_v2_2D_uint8.model.cpp"
+} // namespace topk_v2_2D_uint8
+TEST_F(GeneratedTests, topk_v2_2D_uint8) {
+    execute(topk_v2_2D_uint8::CreateModel,
+            topk_v2_2D_uint8::is_ignored,
+            topk_v2_2D_uint8::examples);
+}
index f615f94..8ad1609 100644 (file)
@@ -1,14 +1,18 @@
 // Generated file (from: gather_1D_float.mod.py). Do not edit
 void CreateModel(Model *model) {
-  OperandType type2(Type::TENSOR_FLOAT32, {2});
+  OperandType type2(Type::INT32, {});
+  OperandType type3(Type::TENSOR_FLOAT32, {2});
   OperandType type0(Type::TENSOR_FLOAT32, {4});
   OperandType type1(Type::TENSOR_INT32, {2});
   // Phase 1, operands
   auto op1 = model->addOperand(&type0);
   auto op2 = model->addOperand(&type1);
-  auto op3 = model->addOperand(&type2);
+  auto axis = model->addOperand(&type2);
+  auto op3 = model->addOperand(&type3);
   // Phase 2, operations
-  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2}, {op3});
+  static int32_t axis_init[] = {0};
+  model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
+  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2, axis}, {op3});
   // Phase 3, inputs and outputs
   model->identifyInputsAndOutputs(
     {op1, op2},
index bebe4d6..ae7fa66 100644 (file)
@@ -1,13 +1,17 @@
 // Generated file (from: gather_1D_int32.mod.py). Do not edit
 void CreateModel(Model *model) {
+  OperandType type2(Type::INT32, {});
   OperandType type1(Type::TENSOR_INT32, {2});
   OperandType type0(Type::TENSOR_INT32, {4});
   // Phase 1, operands
   auto op1 = model->addOperand(&type0);
   auto op2 = model->addOperand(&type1);
+  auto axis = model->addOperand(&type2);
   auto op3 = model->addOperand(&type1);
   // Phase 2, operations
-  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2}, {op3});
+  static int32_t axis_init[] = {0};
+  model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
+  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2, axis}, {op3});
   // Phase 3, inputs and outputs
   model->identifyInputsAndOutputs(
     {op1, op2},
index 478314c..876fc2a 100644 (file)
@@ -1,14 +1,18 @@
 // Generated file (from: gather_1D_uint8.mod.py). Do not edit
 void CreateModel(Model *model) {
+  OperandType type2(Type::INT32, {});
   OperandType type1(Type::TENSOR_INT32, {2});
-  OperandType type2(Type::TENSOR_QUANT8_ASYMM, {2});
+  OperandType type3(Type::TENSOR_QUANT8_ASYMM, {2});
   OperandType type0(Type::TENSOR_QUANT8_ASYMM, {4});
   // Phase 1, operands
   auto op1 = model->addOperand(&type0);
   auto op2 = model->addOperand(&type1);
-  auto op3 = model->addOperand(&type2);
+  auto axis = model->addOperand(&type2);
+  auto op3 = model->addOperand(&type3);
   // Phase 2, operations
-  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2}, {op3});
+  static int32_t axis_init[] = {0};
+  model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
+  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2, axis}, {op3});
   // Phase 3, inputs and outputs
   model->identifyInputsAndOutputs(
     {op1, op2},
index 81270d7..3d80c44 100644 (file)
@@ -1,14 +1,18 @@
 // Generated file (from: gather_2D_float.mod.py). Do not edit
 void CreateModel(Model *model) {
-  OperandType type2(Type::TENSOR_FLOAT32, {2,4});
+  OperandType type2(Type::INT32, {});
+  OperandType type3(Type::TENSOR_FLOAT32, {2,4});
   OperandType type0(Type::TENSOR_FLOAT32, {3,4});
   OperandType type1(Type::TENSOR_INT32, {2});
   // Phase 1, operands
   auto op1 = model->addOperand(&type0);
   auto op2 = model->addOperand(&type1);
-  auto op3 = model->addOperand(&type2);
+  auto axis = model->addOperand(&type2);
+  auto op3 = model->addOperand(&type3);
   // Phase 2, operations
-  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2}, {op3});
+  static int32_t axis_init[] = {0};
+  model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
+  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2, axis}, {op3});
   // Phase 3, inputs and outputs
   model->identifyInputsAndOutputs(
     {op1, op2},
index 6483b69..50411d5 100644 (file)
@@ -1,14 +1,18 @@
 // Generated file (from: gather_2D_int32.mod.py). Do not edit
 void CreateModel(Model *model) {
-  OperandType type2(Type::TENSOR_INT32, {2,4});
+  OperandType type2(Type::INT32, {});
+  OperandType type3(Type::TENSOR_INT32, {2,4});
   OperandType type1(Type::TENSOR_INT32, {2});
   OperandType type0(Type::TENSOR_INT32, {3,4});
   // Phase 1, operands
   auto op1 = model->addOperand(&type0);
   auto op2 = model->addOperand(&type1);
-  auto op3 = model->addOperand(&type2);
+  auto axis = model->addOperand(&type2);
+  auto op3 = model->addOperand(&type3);
   // Phase 2, operations
-  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2}, {op3});
+  static int32_t axis_init[] = {0};
+  model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
+  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2, axis}, {op3});
   // Phase 3, inputs and outputs
   model->identifyInputsAndOutputs(
     {op1, op2},
index 0281963..5c56a3d 100644 (file)
@@ -1,14 +1,18 @@
 // Generated file (from: gather_2D_uint8.mod.py). Do not edit
 void CreateModel(Model *model) {
+  OperandType type2(Type::INT32, {});
   OperandType type1(Type::TENSOR_INT32, {2});
-  OperandType type2(Type::TENSOR_QUANT8_ASYMM, {2,4});
+  OperandType type3(Type::TENSOR_QUANT8_ASYMM, {2,4});
   OperandType type0(Type::TENSOR_QUANT8_ASYMM, {3,4});
   // Phase 1, operands
   auto op1 = model->addOperand(&type0);
   auto op2 = model->addOperand(&type1);
-  auto op3 = model->addOperand(&type2);
+  auto axis = model->addOperand(&type2);
+  auto op3 = model->addOperand(&type3);
   // Phase 2, operations
-  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2}, {op3});
+  static int32_t axis_init[] = {0};
+  model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
+  model->addOperationEx(ANEURALNETWORKS_GATHER_EX, {op1, op2, axis}, {op3});
   // Phase 3, inputs and outputs
   model->identifyInputsAndOutputs(
     {op1, op2},
index 5f8e0be..228a52a 100644 (file)
@@ -2,8 +2,9 @@
 model = Model()
 i1 = Input("op1", "TENSOR_FLOAT32", "{4}") # a vector of 2 float32s
 i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s
+axis = Int32Scalar("axis", 0)
 i3 = Output("op3", "TENSOR_FLOAT32", "{2}")
-model = model.Operation("GATHER_EX", i1, i2).To(i3)
+model = model.Operation("GATHER_EX", i1, i2, axis).To(i3)
 
 # Example 1. Input in operand 0,
 input0 = {i1: # input 0
index 5c81dce..36aa029 100644 (file)
@@ -2,8 +2,9 @@
 model = Model()
 i1 = Input("op1", "TENSOR_INT32", "{4}") # a vector of 2 float32s
 i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s
+axis = Int32Scalar("axis", 0)
 i3 = Output("op3", "TENSOR_INT32", "{2}")
-model = model.Operation("GATHER_EX", i1, i2).To(i3)
+model = model.Operation("GATHER_EX", i1, i2, axis).To(i3)
 
 # Example 1. Input in operand 0,
 input0 = {i1: # input 0
index d849e8a..1e925a7 100644 (file)
@@ -2,8 +2,9 @@
 model = Model()
 i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{4}") # a vector of 2 float32s
 i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s
+axis = Int32Scalar("axis", 0)
 i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2}")
-model = model.Operation("GATHER_EX", i1, i2).To(i3)
+model = model.Operation("GATHER_EX", i1, i2, axis).To(i3)
 
 # Example 1. Input in operand 0,
 input0 = {i1: # input 0
index 82fbf57..5f678c6 100644 (file)
@@ -2,8 +2,9 @@
 model = Model()
 i1 = Input("op1", "TENSOR_FLOAT32", "{3,4}") # a vector of 2 float32s
 i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s
+axis = Int32Scalar("axis", 0)
 i3 = Output("op3", "TENSOR_FLOAT32", "{2,4}")
-model = model.Operation("GATHER_EX", i1, i2).To(i3)
+model = model.Operation("GATHER_EX", i1, i2, axis).To(i3)
 
 # Example 1. Input in operand 0,
 input0 = {i1: # input 0
index 178f5eb..357367b 100644 (file)
@@ -2,8 +2,9 @@
 model = Model()
 i1 = Input("op1", "TENSOR_INT32", "{3,4}") # a vector of 2 float32s
 i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s
+axis = Int32Scalar("axis", 0)
 i3 = Output("op3", "TENSOR_INT32", "{2,4}")
-model = model.Operation("GATHER_EX", i1, i2).To(i3)
+model = model.Operation("GATHER_EX", i1, i2, axis).To(i3)
 
 # Example 1. Input in operand 0,
 input0 = {i1: # input 0
index 405f6e6..5774d7f 100644 (file)
@@ -2,8 +2,9 @@
 model = Model()
 i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{3,4}") # a vector of 2 float32s
 i2 = Input("op2", "TENSOR_INT32", "{2}") # another vector of 2 int32s
+axis = Int32Scalar("axis", 0)
 i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2,4}")
-model = model.Operation("GATHER_EX", i1, i2).To(i3)
+model = model.Operation("GATHER_EX", i1, i2, axis).To(i3)
 
 # Example 1. Input in operand 0,
 input0 = {i1: # input 0