From: Siva Sai Vaddipati/System SW /SRI-Bangalore/Engineer/삼성전자 Date: Fri, 9 Nov 2018 07:50:55 +0000 (+0530) Subject: Adding testcases for NotEqual Op (#3516) X-Git-Tag: 0.3~433 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93ff4bd1479a4608bb0a0d6006d11426c8e38961;p=platform%2Fcore%2Fml%2Fnnfw.git Adding testcases for NotEqual Op (#3516) This commit adds Gtest testcases for NotEqual op. Related issues: #3335,#3337 Signed-off-by: Siva Sai --- diff --git a/runtimes/tests/neural_networks_test/generated/all_generated_tests.cpp b/runtimes/tests/neural_networks_test/generated/all_generated_tests.cpp index ae60402..c0a2780 100644 --- a/runtimes/tests/neural_networks_test/generated/all_generated_tests.cpp +++ b/runtimes/tests/neural_networks_test/generated/all_generated_tests.cpp @@ -3165,6 +3165,20 @@ TEST_F(GeneratedTests, neg_ex_2D_float) { neg_ex_2D_float::examples); } +namespace notequal_ex_float { +std::vector examples = { +// Generated notequal_ex_float test +#include "generated/examples/notequal_ex_float.example.cpp" +}; +// Generated model constructor +#include "generated/models/notequal_ex_float.model.cpp" +} // namespace notequal_ex_float +TEST_F(GeneratedTests, notequal_ex_float) { + execute(notequal_ex_float::CreateModel, + notequal_ex_float::is_ignored, + notequal_ex_float::examples); +} + namespace squared_difference_ex_1D_float { std::vector examples = { // Generated squared_difference_ex_1D_float test diff --git a/runtimes/tests/neural_networks_test/generated/examples/notequal_ex_float.example.cpp b/runtimes/tests/neural_networks_test/generated/examples/notequal_ex_float.example.cpp new file mode 100644 index 0000000..f231b17 --- /dev/null +++ b/runtimes/tests/neural_networks_test/generated/examples/notequal_ex_float.example.cpp @@ -0,0 +1,22 @@ +// Generated file (from: notequal_ex_1D_float.mod.py). Do not edit +// Begin of an example +{ +//Input(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {2.0f, 3.254232f, 5.1232f}}, {1, {2.0f, 3.254111f, 5.1232f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {{0, {0, 1, 0}}} +} +}, // End of an example diff --git a/runtimes/tests/neural_networks_test/generated/models/notequal_ex_float.model.cpp b/runtimes/tests/neural_networks_test/generated/models/notequal_ex_float.model.cpp new file mode 100644 index 0000000..b47a53e --- /dev/null +++ b/runtimes/tests/neural_networks_test/generated/models/notequal_ex_float.model.cpp @@ -0,0 +1,21 @@ +// Generated file (from: equal_ex_1D_float.mod.py). Do not edit +void CreateModel(Model *model) { + OperandType type0(Type::TENSOR_FLOAT32, {3}); + OperandType type1(Type::TENSOR_QUANT8_ASYMM, {3}, 1.f, 0); + // Phase 1, operands + auto op1 = model->addOperand(&type0); + auto op2 = model->addOperand(&type0); + auto op3 = model->addOperand(&type1); + // Phase 2, operations + model->addOperationEx(ANEURALNETWORKS_EQUAL_EX, {op1, op2}, {op3}); + // Phase 3, inputs and outputs + model->identifyInputsAndOutputs( + {op1, op2}, + {op3}); + assert(model->isValid()); +} + +bool is_ignored(int i) { + static std::set ignore = {}; + return ignore.find(i) != ignore.end(); +} diff --git a/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-linux.neurun b/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-linux.neurun index eb89d41..1e2a061 100644 --- a/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-linux.neurun +++ b/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-linux.neurun @@ -76,6 +76,7 @@ GeneratedTests.mobilenet* GeneratedTests.mul* GeneratedTests.neg_ex_1D_float GeneratedTests.neg_ex_2D_float +GeneratedTests.notequal* GeneratedTests.relu1* GeneratedTests.relu6* GeneratedTests.relu* diff --git a/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-tizen b/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-tizen index eb59083..efe1b7c 100644 --- a/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-tizen +++ b/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-tizen @@ -47,6 +47,7 @@ GeneratedTests.mean_quant8_2 GeneratedTests.mobilenet_quantized GeneratedTests.neg_ex_1D_float GeneratedTests.neg_ex_2D_float +GeneratedTests.notequal* GeneratedTests.pad GeneratedTests.pad_float_1 GeneratedTests.space_to_batch diff --git a/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.x86_64-linux b/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.x86_64-linux index 68ec117..1cabb41 100644 --- a/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.x86_64-linux +++ b/runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.x86_64-linux @@ -39,6 +39,7 @@ GeneratedTests.lstm_state2 GeneratedTests.lstm_state GeneratedTests.neg_ex_1D_float GeneratedTests.neg_ex_2D_float +GeneratedTests.notequal* GeneratedTests.relu1_float_1 GeneratedTests.relu1_float_2 GeneratedTests.relu1_quant8_1 diff --git a/runtimes/tests/neural_networks_test/specs/Ex/notequal_ex_1D_float.mod.py b/runtimes/tests/neural_networks_test/specs/Ex/notequal_ex_1D_float.mod.py new file mode 100644 index 0000000..ad0fe42 --- /dev/null +++ b/runtimes/tests/neural_networks_test/specs/Ex/notequal_ex_1D_float.mod.py @@ -0,0 +1,18 @@ +# model +model = Model() +i1 = Input("op1", "TENSOR_FLOAT32", "{3}") # a vector of input +i2 = Input("op2", "TENSOR_FLOAT32", "{3}") # a vector of input +i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{3}, 1.f, 0") # a vector of output +model = model.Operation("EQUAL_EX", i1, i2).To(i3) + +# Example 1. Input in operand 0, +input0 = {i1: # input 0 + [2.0, 3.254232, 5.1232], + i2: # input 1 + [2.0, 3.254111, 5.1232]} + +output0 = {i3: # output 0 + [0, 1, 0]} + +# Instantiate an example +Example((input0, output0))