Modify gather operation and testdata (#2407)
author남궁석/동작제어Lab(SR)/Engineer/삼성전자 <sk.namkoong@samsung.com>
Thu, 23 Aug 2018 04:43:47 +0000 (13:43 +0900)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Thu, 23 Aug 2018 04:43:47 +0000 (13:43 +0900)
`GeneratedTests.gather_1D_uint8` and `GeneratedTests.gather_2D_uint8` are tests for `gather` operation using quant8 type
However, despite not correctly given test data format, two tests are passed because of weak dataset
And more seriously, `gather` operation do not support quant8 yet
Therefore we should disable the two tests

 - Modify `_uint8` to `_quant8` in test name
 - Modify test data for `GeneratedTests.gather_1D_uint8` and `GeneratedTests.gather_2D_uint8`
 - Disable `GeneratedTests.gather_1D_uint8` and `GeneratedTests.gather_2D_uint8`

Signed-off-by: Seok NamKoong <sk.namkoong@samsung.com>
runtimes/tests/neural_networks_test/generated/all_generated_tests.cpp
runtimes/tests/neural_networks_test/generated/examples/gather_1D_quant8.example.cpp [moved from runtimes/tests/neural_networks_test/generated/examples/gather_1D_uint8.example.cpp with 91% similarity]
runtimes/tests/neural_networks_test/generated/examples/gather_2D_quant8.example.cpp [moved from runtimes/tests/neural_networks_test/generated/examples/gather_2D_uint8.example.cpp with 82% similarity]
runtimes/tests/neural_networks_test/generated/models/gather_1D_quant8.model.cpp [moved from runtimes/tests/neural_networks_test/generated/models/gather_1D_uint8.model.cpp with 86% similarity]
runtimes/tests/neural_networks_test/generated/models/gather_2D_quant8.model.cpp [moved from runtimes/tests/neural_networks_test/generated/models/gather_2D_uint8.model.cpp with 86% similarity]
runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-linux
runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-tizen
runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.x86_64-linux
runtimes/tests/neural_networks_test/specs/Ex/gather_1D_quant8.mod.py [moved from runtimes/tests/neural_networks_test/specs/Ex/gather_1D_uint8.mod.py with 66% similarity]
runtimes/tests/neural_networks_test/specs/Ex/gather_2D_quant8.mod.py [moved from runtimes/tests/neural_networks_test/specs/Ex/gather_2D_uint8.mod.py with 57% similarity]

index 388828d..da475b3 100644 (file)
@@ -2927,18 +2927,18 @@ TEST_F(GeneratedTests, gather_1D_int32) {
             gather_1D_int32::examples);
 }
 
-namespace gather_1D_uint8 {
+namespace gather_1D_quant8 {
 std::vector<MixedTypedExample> examples = {
-// Generated gather_1D_uint8 test
-#include "generated/examples/gather_1D_uint8.example.cpp"
+// Generated gather_1D_quant8 test
+#include "generated/examples/gather_1D_quant8.example.cpp"
 };
 // Generated model constructor
-#include "generated/models/gather_1D_uint8.model.cpp"
-} // namespace gather_1D_uint8
-TEST_F(GeneratedTests, gather_1D_uint8) {
-    execute(gather_1D_uint8::CreateModel,
-            gather_1D_uint8::is_ignored,
-            gather_1D_uint8::examples);
+#include "generated/models/gather_1D_quant8.model.cpp"
+} // namespace gather_1D_quant8
+TEST_F(GeneratedTests, gather_1D_quant8) {
+    execute(gather_1D_quant8::CreateModel,
+            gather_1D_quant8::is_ignored,
+            gather_1D_quant8::examples);
 }
 
 namespace gather_2D_float {
@@ -2969,18 +2969,18 @@ TEST_F(GeneratedTests, gather_2D_int32) {
             gather_2D_int32::examples);
 }
 
-namespace gather_2D_uint8 {
+namespace gather_2D_quant8 {
 std::vector<MixedTypedExample> examples = {
-// Generated gather_2D_uint8 test
-#include "generated/examples/gather_2D_uint8.example.cpp"
+// Generated gather_2D_quant8 test
+#include "generated/examples/gather_2D_quant8.example.cpp"
 };
 // Generated model constructor
-#include "generated/models/gather_2D_uint8.model.cpp"
-} // namespace gather_2D_uint8
-TEST_F(GeneratedTests, gather_2D_uint8) {
-    execute(gather_2D_uint8::CreateModel,
-            gather_2D_uint8::is_ignored,
-            gather_2D_uint8::examples);
+#include "generated/models/gather_2D_quant8.model.cpp"
+} // namespace gather_2D_quant8
+TEST_F(GeneratedTests, gather_2D_quant8) {
+    execute(gather_2D_quant8::CreateModel,
+            gather_2D_quant8::is_ignored,
+            gather_2D_quant8::examples);
 }
 
 namespace tensorflowmax_ex_2D_float {
@@ -8,7 +8,7 @@
   // int -> INT32 map
   {{1, {2, 0}}},
   // int -> QUANT8_ASYMM map
-  {{0, {3, 4, 5, 6}}}
+  {{0, {7, 9, 11, 13}}}
 },
 //Output(s)
 { // See tools/test_generator/include/TestHarness.h:MixedTyped
@@ -17,6 +17,6 @@
   // int -> INT32 map
   {},
   // int -> QUANT8_ASYMM map
-  {{0, {5, 3}}}
+  {{0, {11, 7}}}
 }
 }, // End of an example
@@ -8,7 +8,7 @@
   // int -> INT32 map
   {{1, {2, 0}}},
   // int -> QUANT8_ASYMM map
-  {{0, {3, 4, 5, 6, 7, 8, 9, 1, 2, 18, 19, 11}}}
+  {{0, {7, 9, 11, 13, 15, 17, 19, 3, 5, 37, 39, 23}}}
 },
 //Output(s)
 { // See tools/test_generator/include/TestHarness.h:MixedTyped
@@ -17,6 +17,6 @@
   // int -> INT32 map
   {},
   // int -> QUANT8_ASYMM map
-  {{0, {2, 18, 19, 11, 3, 4, 5, 6}}}
+  {{0, {5, 37, 39, 23, 7, 9, 11, 13}}}
 }
 }, // End of an example
@@ -2,8 +2,8 @@
 void CreateModel(Model *model) {
   OperandType type2(Type::INT32, {});
   OperandType type1(Type::TENSOR_INT32, {2});
-  OperandType type3(Type::TENSOR_QUANT8_ASYMM, {2});
-  OperandType type0(Type::TENSOR_QUANT8_ASYMM, {4});
+  OperandType type3(Type::TENSOR_QUANT8_ASYMM, {2}, 0.5f, 1);
+  OperandType type0(Type::TENSOR_QUANT8_ASYMM, {4}, 0.5f, 1);
   // Phase 1, operands
   auto op1 = model->addOperand(&type0);
   auto op2 = model->addOperand(&type1);
@@ -2,8 +2,8 @@
 void CreateModel(Model *model) {
   OperandType type2(Type::INT32, {});
   OperandType type1(Type::TENSOR_INT32, {2});
-  OperandType type3(Type::TENSOR_QUANT8_ASYMM, {2,4});
-  OperandType type0(Type::TENSOR_QUANT8_ASYMM, {3,4});
+  OperandType type3(Type::TENSOR_QUANT8_ASYMM, {2,4}, 0.5f, 1);
+  OperandType type0(Type::TENSOR_QUANT8_ASYMM, {3,4}, 0.5f, 1);
   // Phase 1, operands
   auto op1 = model->addOperand(&type0);
   auto op2 = model->addOperand(&type1);
index 20a5d3e..1e5e639 100644 (file)
@@ -114,3 +114,5 @@ GeneratedTests.space_to_batch_quant8_3
 GeneratedTests.transpose_float_1
 GeneratedTests.transpose
 GeneratedTests.transpose_quant8_1
+GeneratedTests.gather_1D_quant8
+GeneratedTests.gather_2D_quant8
index 1a72531..99af1ed 100644 (file)
@@ -177,3 +177,5 @@ GeneratedTests.strided_slice_quant8_9
 GeneratedTests.transpose_float_1
 GeneratedTests.transpose
 GeneratedTests.transpose_quant8_1
+GeneratedTests.gather_1D_quant8
+GeneratedTests.gather_2D_quant8
@@ -1,19 +1,19 @@
 # model
 model = Model()
-i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{4}") # a vector of 2 float32s
+i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{4}, 0.5f, 1") # 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}")
+i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2}, 0.5f, 1")
 model = model.Operation("GATHER_EX", i1, i2, axis).To(i3)
 
 # Example 1. Input in operand 0,
 input0 = {i1: # input 0
-          [3, 4, 5, 6],
+          [7, 9, 11, 13],
           i2: # input 1
           [2, 0]}
 
 output0 = {i3: # output 0
-           [5, 3]}
+           [11, 7]}
 
 # Instantiate an example
 Example((input0, output0))
@@ -1,22 +1,22 @@
 # model
 model = Model()
-i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{3,4}") # a vector of 2 float32s
+i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{3,4}, 0.5f, 1") # 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}")
+i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2,4}, 0.5f, 1")
 model = model.Operation("GATHER_EX", i1, i2, axis).To(i3)
 
 # Example 1. Input in operand 0,
 input0 = {i1: # input 0
-          [3, 4, 5, 6,
-          7, 8, 9, 1,
-          2, 18, 19, 11],
+          [7, 9, 11, 13,
+          15, 17, 19, 3,
+          5, 37, 39, 23],
           i2: # input 1
           [2, 0]}
 
 output0 = {i3: # output 0
-           [2, 18, 19, 11,
-           3, 4, 5, 6]}
+           [5, 37, 39, 23,
+           7, 9, 11, 13]}
 
 # Instantiate an example
 Example((input0, output0))