Added Generic test file for RSQRT_EX (#3297)
authorTANUJ TEKRIWAL/System SW /SRI-Bangalore/Engineer/삼성전자 <tanuj.tekri@samsung.com>
Tue, 20 Nov 2018 05:25:46 +0000 (10:55 +0530)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Tue, 20 Nov 2018 05:25:46 +0000 (14:25 +0900)
This patch adds the Gtest file for RSQRT_EX.

Signed-off-by: Tanuj Tekriwal <tanuj.tekri@samsung.com>
runtimes/tests/neural_networks_test/generated/all_generated_tests.cpp
runtimes/tests/neural_networks_test/generated/examples/rsqrt_ex_float_1.example.cpp [new file with mode: 0644]
runtimes/tests/neural_networks_test/generated/models/rsqrt_ex_float_1.model.cpp [new file with mode: 0644]
runtimes/tests/neural_networks_test/runtime_run_android_nn_test.skip.armv7l-linux.neurun
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/rsqrt_ex_float_1.mod.py [new file with mode: 0644]

index e1ac61e..701adc4 100644 (file)
@@ -3333,6 +3333,20 @@ TEST_F(GeneratedTests, neg_ex_2D_float) {
             neg_ex_2D_float::examples);
 }
 
+namespace rsqrt_ex_float_1 {
+std::vector<MixedTypedExample> examples = {
+// Generated rsqrt_ex_float_1 test
+#include "generated/examples/rsqrt_ex_float_1.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/rsqrt_ex_float_1.model.cpp"
+} // namespace rsqrt_ex_float_1
+TEST_F(GeneratedTests, rsqrt_ex_float_1) {
+    execute(rsqrt_ex_float_1::CreateModel,
+            rsqrt_ex_float_1::is_ignored,
+            rsqrt_ex_float_1::examples);
+}
+
 namespace notequal_ex_float {
 std::vector<MixedTypedExample> examples = {
 // Generated notequal_ex_float test
diff --git a/runtimes/tests/neural_networks_test/generated/examples/rsqrt_ex_float_1.example.cpp b/runtimes/tests/neural_networks_test/generated/examples/rsqrt_ex_float_1.example.cpp
new file mode 100644 (file)
index 0000000..cbe9edc
--- /dev/null
@@ -0,0 +1,22 @@
+// Generated file (from: rsqrt_ex_float_1.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+  // int -> FLOAT32 map
+  {{0, {1.0f, 2.0f, 4.0f, 8.0f}}},
+  // int -> INT32 map
+  {},
+  // int -> QUANT8_ASYMM map
+  {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+  // int -> FLOAT32 map
+  {{0, {1.0f, 0.70710678118f, 0.5f, 0.35355339059f}}},
+  // int -> INT32 map
+  {},
+  // int -> QUANT8_ASYMM map
+  {}
+}
+}, // End of an example
diff --git a/runtimes/tests/neural_networks_test/generated/models/rsqrt_ex_float_1.model.cpp b/runtimes/tests/neural_networks_test/generated/models/rsqrt_ex_float_1.model.cpp
new file mode 100644 (file)
index 0000000..a615258
--- /dev/null
@@ -0,0 +1,19 @@
+// Generated file (from: rsqrt_ex_float_1.mod.py). Do not edit
+void CreateModel(Model *model) {
+  OperandType type0(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
+  // Phase 1, operands
+  auto op1 = model->addOperand(&type0);
+  auto op3 = model->addOperand(&type0);
+  // Phase 2, operations
+  model->addOperationEx(ANEURALNETWORKS_RSQRT_EX, {op1}, {op3});
+  // Phase 3, inputs and outputs
+  model->identifyInputsAndOutputs(
+    {op1},
+    {op3});
+  assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+  static std::set<int> ignore = {};
+  return ignore.find(i) != ignore.end();
+}
index 3e8bcbc..57d1cc3 100644 (file)
@@ -83,6 +83,7 @@ GeneratedTests.relu6*
 GeneratedTests.relu*
 GeneratedTests.resize_bilinear*
 GeneratedTests.rnn*
+GeneratedTests.rsqrt*
 GeneratedTests.mean*
 GeneratedTests.pad*
 GeneratedTests.space_to_depth*
index 8e6dc74..a8c6c53 100644 (file)
@@ -50,6 +50,7 @@ GeneratedTests.neg_ex_2D_float
 GeneratedTests.notequal*
 GeneratedTests.pad
 GeneratedTests.pad_float_1
+GeneratedTests.rsqrt_ex_float_1
 GeneratedTests.space_to_batch
 GeneratedTests.space_to_batch_float_1
 GeneratedTests.space_to_batch_float_2
index b2a3c1b..99ff4a9 100644 (file)
@@ -46,6 +46,7 @@ GeneratedTests.relu1_quant8_1
 GeneratedTests.relu1_quant8_2
 GeneratedTests.rnn
 GeneratedTests.rnn_state
+GeneratedTests.rsqrt_ex_float_1
 GeneratedTests.space_to_depth_float_1
 GeneratedTests.space_to_depth_float_2
 GeneratedTests.space_to_depth_float_3
diff --git a/runtimes/tests/neural_networks_test/specs/Ex/rsqrt_ex_float_1.mod.py b/runtimes/tests/neural_networks_test/specs/Ex/rsqrt_ex_float_1.mod.py
new file mode 100644 (file)
index 0000000..2178f8f
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# model
+model = Model()
+
+i1 = Input("op1", "TENSOR_FLOAT32", "{1, 2, 2, 1}")
+i3 = Output("op3", "TENSOR_FLOAT32", "{1, 2, 2, 1}")
+model = model.Operation("RSQRT_EX", i1).To(i3)
+
+# Example 1. Input in operand 0,
+input0 = {i1: # input 0
+          [1.0, 2.0, 4.0, 8.0]}
+
+output0 = {i3: # output 0
+           [1.0,
+            0.70710678118,
+            0.5,
+            0.35355339059]}
+
+# Instantiate an example
+Example((input0, output0))