From: 최성진/동작제어Lab(SR)/Principal Engineer/삼성전자 Date: Tue, 5 Jun 2018 02:52:22 +0000 (+0900) Subject: [Topkv2 Op] modify output's order of Topk_v2 operation (#1470) X-Git-Tag: 0.2~689 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e11eb146311aa6be42c37a8d8731017b75b0d62;p=platform%2Fcore%2Fml%2Fnnfw.git [Topkv2 Op] modify output's order of Topk_v2 operation (#1470) This commit modifies output's order of Topk_v2 operation in runtime_run_android_nn_test. -First one is values of output and second one is indexes of output. Signed-off-by: SungJin Choi --- diff --git a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_float.example.cpp b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_float.example.cpp index 88521f9..c649944 100644 --- a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_float.example.cpp +++ b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_float.example.cpp @@ -13,9 +13,9 @@ //Output(s) { // See tools/test_generator/include/TestHarness.h:MixedTyped // int -> FLOAT32 map - {{1, {6.123456789123456f, 5.123456789123456f}}}, + {{0, {6.123456789123456f, 5.123456789123456f}}}, // int -> INT32 map - {{0, {3, 2}}}, + {{1, {3, 2}}}, // int -> QUANT8_ASYMM map {} } diff --git a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_int32.example.cpp b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_int32.example.cpp index bb62a91..8fdf792 100644 --- a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_int32.example.cpp +++ b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_int32.example.cpp @@ -15,7 +15,7 @@ // int -> FLOAT32 map {}, // int -> INT32 map - {{0, {3, 2}}, {1, {60000, 50000}}}, + {{0, {60000, 50000}}, {1, {3, 2}}}, // int -> QUANT8_ASYMM map {} } diff --git a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_uint8.example.cpp b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_uint8.example.cpp index 74e4aec..bdb7ab0 100644 --- a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_uint8.example.cpp +++ b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_1D_uint8.example.cpp @@ -15,8 +15,8 @@ // int -> FLOAT32 map {}, // int -> INT32 map - {{0, {3, 2}}}, + {{1, {3, 2}}}, // int -> QUANT8_ASYMM map - {{1, {6, 5}}} + {{0, {6, 5}}} } }, // End of an example diff --git a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_float.example.cpp b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_float.example.cpp index 2962f77..393a7a8 100644 --- a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_float.example.cpp +++ b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_float.example.cpp @@ -13,9 +13,9 @@ //Output(s) { // See tools/test_generator/include/TestHarness.h:MixedTyped // int -> FLOAT32 map - {{1, {6.123456789123456f, 5.123456789123456f, 9.123456789123457f, 8.123456789123457f, 19.123456789123455f, 18.123456789123455f}}}, + {{0, {6.123456789123456f, 5.123456789123456f, 9.123456789123457f, 8.123456789123457f, 19.123456789123455f, 18.123456789123455f}}}, // int -> INT32 map - {{0, {3, 2, 2, 1, 2, 1}}}, + {{1, {3, 2, 2, 1, 2, 1}}}, // int -> QUANT8_ASYMM map {} } diff --git a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_int32.example.cpp b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_int32.example.cpp index 9c413e4..6204572 100644 --- a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_int32.example.cpp +++ b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_int32.example.cpp @@ -15,7 +15,7 @@ // int -> FLOAT32 map {}, // int -> INT32 map - {{0, {3, 2, 2, 1, 2, 1}}, {1, {60000, 50000, 90000, 80000, 190000, 180000}}}, + {{0, {60000, 50000, 90000, 80000, 190000, 180000}}, {1, {3, 2, 2, 1, 2, 1}}}, // int -> QUANT8_ASYMM map {} } diff --git a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_uint8.example.cpp b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_uint8.example.cpp index f6a05a7..3363c8b 100644 --- a/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_uint8.example.cpp +++ b/runtimes/tests/neural_networks_test/generated/examples/topk_v2_2D_uint8.example.cpp @@ -15,8 +15,8 @@ // int -> FLOAT32 map {}, // int -> INT32 map - {{0, {3, 2, 2, 1, 2, 1}}}, + {{1, {3, 2, 2, 1, 2, 1}}}, // int -> QUANT8_ASYMM map - {{1, {6, 5, 9, 8, 19, 18}}} + {{0, {6, 5, 9, 8, 19, 18}}} } }, // End of an example diff --git a/runtimes/tests/neural_networks_test/generated/models/topk_v2_1D_float.model.cpp b/runtimes/tests/neural_networks_test/generated/models/topk_v2_1D_float.model.cpp index 40d225b..2316832 100644 --- a/runtimes/tests/neural_networks_test/generated/models/topk_v2_1D_float.model.cpp +++ b/runtimes/tests/neural_networks_test/generated/models/topk_v2_1D_float.model.cpp @@ -1,9 +1,9 @@ // Generated file (from: topk_v2_1D_float.mod.py). Do not edit void CreateModel(Model *model) { OperandType type1(Type::INT32, {}); - OperandType type3(Type::TENSOR_FLOAT32, {2}); + OperandType type2(Type::TENSOR_FLOAT32, {2}); OperandType type0(Type::TENSOR_FLOAT32, {4}); - OperandType type2(Type::TENSOR_INT32, {2}); + OperandType type3(Type::TENSOR_INT32, {2}); // Phase 1, operands auto op1 = model->addOperand(&type0); auto k = model->addOperand(&type1); diff --git a/runtimes/tests/neural_networks_test/generated/models/topk_v2_1D_uint8.model.cpp b/runtimes/tests/neural_networks_test/generated/models/topk_v2_1D_uint8.model.cpp index 02e7d2a..0d3cd4f 100644 --- a/runtimes/tests/neural_networks_test/generated/models/topk_v2_1D_uint8.model.cpp +++ b/runtimes/tests/neural_networks_test/generated/models/topk_v2_1D_uint8.model.cpp @@ -1,8 +1,8 @@ // Generated file (from: topk_v2_1D_uint8.mod.py). Do not edit void CreateModel(Model *model) { OperandType type1(Type::INT32, {}); - OperandType type2(Type::TENSOR_INT32, {2}); - OperandType type3(Type::TENSOR_QUANT8_ASYMM, {2}); + OperandType type3(Type::TENSOR_INT32, {2}); + OperandType type2(Type::TENSOR_QUANT8_ASYMM, {2}); OperandType type0(Type::TENSOR_QUANT8_ASYMM, {4}); // Phase 1, operands auto op1 = model->addOperand(&type0); diff --git a/runtimes/tests/neural_networks_test/generated/models/topk_v2_2D_float.model.cpp b/runtimes/tests/neural_networks_test/generated/models/topk_v2_2D_float.model.cpp index a94f6e1..17097cd 100644 --- a/runtimes/tests/neural_networks_test/generated/models/topk_v2_2D_float.model.cpp +++ b/runtimes/tests/neural_networks_test/generated/models/topk_v2_2D_float.model.cpp @@ -1,9 +1,9 @@ // Generated file (from: topk_v2_2D_float.mod.py). Do not edit void CreateModel(Model *model) { OperandType type1(Type::INT32, {}); - OperandType type3(Type::TENSOR_FLOAT32, {3,2}); + OperandType type2(Type::TENSOR_FLOAT32, {3,2}); OperandType type0(Type::TENSOR_FLOAT32, {3,4}); - OperandType type2(Type::TENSOR_INT32, {3,2}); + OperandType type3(Type::TENSOR_INT32, {3,2}); // Phase 1, operands auto op1 = model->addOperand(&type0); auto k = model->addOperand(&type1); diff --git a/runtimes/tests/neural_networks_test/generated/models/topk_v2_2D_uint8.model.cpp b/runtimes/tests/neural_networks_test/generated/models/topk_v2_2D_uint8.model.cpp index d763067..e86a070 100644 --- a/runtimes/tests/neural_networks_test/generated/models/topk_v2_2D_uint8.model.cpp +++ b/runtimes/tests/neural_networks_test/generated/models/topk_v2_2D_uint8.model.cpp @@ -1,8 +1,8 @@ // Generated file (from: topk_v2_2D_uint8.mod.py). Do not edit void CreateModel(Model *model) { OperandType type1(Type::INT32, {}); - OperandType type2(Type::TENSOR_INT32, {3,2}); - OperandType type3(Type::TENSOR_QUANT8_ASYMM, {3,2}); + OperandType type3(Type::TENSOR_INT32, {3,2}); + OperandType type2(Type::TENSOR_QUANT8_ASYMM, {3,2}); OperandType type0(Type::TENSOR_QUANT8_ASYMM, {3,4}); // Phase 1, operands auto op1 = model->addOperand(&type0); diff --git a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_float.mod.py b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_float.mod.py index d0dca61..c7a74dc 100644 --- a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_float.mod.py +++ b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_float.mod.py @@ -2,8 +2,8 @@ model = Model() i1 = Input("op1", "TENSOR_FLOAT32", "{4}") # a vector of input k = Int32Scalar("k", 2) -i2 = Output("op2", "TENSOR_INT32", "{2}") # indexes of output -i3 = Output("op3", "TENSOR_FLOAT32", "{2}") # values of output +i2 = Output("op2", "TENSOR_FLOAT32", "{2}") # values of output +i3 = Output("op3", "TENSOR_INT32", "{2}") # indexes of output model = model.Operation("TOPK_V2_EX", i1, k).To([i2, i3]) # Example 1. Input in operand 0, @@ -11,9 +11,9 @@ input0 = {i1: # input 0 [3.123456789123456789, 4.123456789123456789, 5.123456789123456789, 6.123456789123456789]} output0 = {i2: # output 0 - [3, 2], + [6.123456789123456789, 5.123456789123456789], i3: # output 1 - [6.123456789123456789, 5.123456789123456789]} + [3, 2]} # Instantiate an example Example((input0, output0)) diff --git a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_int32.mod.py b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_int32.mod.py index 79d5f47..efe7947 100644 --- a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_int32.mod.py +++ b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_int32.mod.py @@ -2,8 +2,8 @@ model = Model() i1 = Input("op1", "TENSOR_INT32", "{4}") # a vector of input k = Int32Scalar("k", 2) -i2 = Output("op2", "TENSOR_INT32", "{2}") # indexes of output -i3 = Output("op3", "TENSOR_INT32", "{2}") # values of output +i2 = Output("op2", "TENSOR_INT32", "{2}") # values of output +i3 = Output("op3", "TENSOR_INT32", "{2}") # indexes of output model = model.Operation("TOPK_V2_EX", i1, k).To([i2, i3]) # Example 1. Input in operand 0, @@ -11,9 +11,9 @@ input0 = {i1: # input 0 [40000, 41000, 50000, 60000]} output0 = {i2: # output 0 - [3, 2], + [60000, 50000], i3: # output 1 - [60000, 50000]} + [3, 2]} # Instantiate an example Example((input0, output0)) diff --git a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_uint8.mod.py b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_uint8.mod.py index d2c6c12..6b6b088 100644 --- a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_uint8.mod.py +++ b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_1D_uint8.mod.py @@ -2,8 +2,8 @@ model = Model() i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{4}") # a vector of input k = Int32Scalar("k", 2) -i2 = Output("op2", "TENSOR_INT32", "{2}") # indexes of output -i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{2}") # values of output +i2 = Output("op2", "TENSOR_QUANT8_ASYMM", "{2}") # values of output +i3 = Output("op3", "TENSOR_INT32", "{2}") # indexes of output model = model.Operation("TOPK_V2_EX", i1, k).To([i2, i3]) # Example 1. Input in operand 0, @@ -11,9 +11,9 @@ input0 = {i1: # input 0 [3, 4, 5, 6]} output0 = {i2: # output 0 - [3, 2], + [6, 5], i3: # output 1 - [6, 5]} + [3, 2]} # Instantiate an example Example((input0, output0)) diff --git a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_float.mod.py b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_float.mod.py index 7de691c..204bc14 100644 --- a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_float.mod.py +++ b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_float.mod.py @@ -2,8 +2,8 @@ model = Model() i1 = Input("op1", "TENSOR_FLOAT32", "{3,4}") # a matirx of input k = Int32Scalar("k", 2) -o1 = Output("op2", "TENSOR_INT32", "{3,2}") # indexes of output -o2 = Output("op3", "TENSOR_FLOAT32", "{3,2}") # values of output +o1 = Output("op2", "TENSOR_FLOAT32", "{3,2}") # values of output +o2 = Output("op3", "TENSOR_INT32", "{3,2}") # indexes of output model = model.Operation("TOPK_V2_EX", i1, k).To([o1, o2]) # Example 1. Input in operand 0, @@ -12,14 +12,14 @@ input0 = {i1: # input 0 7.123456789123456789, 8.123456789123456789, 9.123456789123456789, 1.123456789123456789, 2.123456789123456789, 18.123456789123456789, 19.123456789123456789, 11.123456789123456789]} -output0 = {o1: # output 0 - [3, 2, - 2, 1, - 2, 1], - o2: # output 1 +output0 = {o1: # output 1 [6.123456789123456789, 5.123456789123456789, 9.123456789123456789, 8.123456789123456789, - 19.123456789123456789, 18.123456789123456789]} + 19.123456789123456789, 18.123456789123456789], + o2: # output 1 + [3, 2, + 2, 1, + 2, 1]} # Instantiate an example Example((input0, output0)) diff --git a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_int32.mod.py b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_int32.mod.py index d688927..b90a354 100644 --- a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_int32.mod.py +++ b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_int32.mod.py @@ -13,13 +13,13 @@ input0 = {i1: # input 0 170000, 180000, 190000, 110000]} output0 = {i2: # output 0 - [3, 2, - 2, 1, - 2, 1], - i3: # output 1 [60000, 50000, 90000, 80000, - 190000, 180000]} + 190000, 180000], + i3: # output 1 + [3, 2, + 2, 1, + 2, 1]} # Instantiate an example Example((input0, output0)) diff --git a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_uint8.mod.py b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_uint8.mod.py index a6e0efc..c18847d 100644 --- a/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_uint8.mod.py +++ b/runtimes/tests/neural_networks_test/specs/Ex/topk_v2_2D_uint8.mod.py @@ -2,8 +2,8 @@ model = Model() i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "{3,4}") # a vector of input k = Int32Scalar("k", 2) -i2 = Output("op2", "TENSOR_INT32", "{3,2}") # indexes of output -i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{3,2}") # values of output +i2 = Output("op2", "TENSOR_QUANT8_ASYMM", "{3,2}") # values of output +i3 = Output("op3", "TENSOR_INT32", "{3,2}") # indexes of output model = model.Operation("TOPK_V2_EX", i1, k).To([i2, i3]) # Example 1. Input in operand 0, @@ -13,13 +13,13 @@ input0 = {i1: # input 0 2, 18, 19, 11]} output0 = {i2: # output 0 - [3, 2, - 2, 1, - 2, 1], - i3: # output 1 [6, 5, 9, 8, - 19, 18]} + 19, 18], + i3: # output 1 + [3, 2, + 2, 1, + 2, 1]} # Instantiate an example Example((input0, output0))