summaryrefslogtreecommitdiff
path: root/externals/nnapi_test_generator/tests
diff options
context:
space:
mode:
Diffstat (limited to 'externals/nnapi_test_generator/tests')
-rw-r--r--externals/nnapi_test_generator/tests/P_conv/conv_1_h3_w2_SAME.mod.py11
-rw-r--r--externals/nnapi_test_generator/tests/P_conv/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_conv/stdout.txt.expect41
-rw-r--r--externals/nnapi_test_generator/tests/P_depthwise_conv/depthwise_conv.bin.mod.py11
-rw-r--r--externals/nnapi_test_generator/tests/P_depthwise_conv/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_depthwise_conv/stdout.txt.expect43
-rw-r--r--externals/nnapi_test_generator/tests/P_explicit/explicit_add.mod.py7
-rw-r--r--externals/nnapi_test_generator/tests/P_explicit/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_explicit/stdout.txt.expect21
-rw-r--r--externals/nnapi_test_generator/tests/P_float/addfloat.mod.py8
-rw-r--r--externals/nnapi_test_generator/tests/P_float/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_float/stdout.txt.expect23
-rw-r--r--externals/nnapi_test_generator/tests/P_full/addfloat.mod.py22
-rw-r--r--externals/nnapi_test_generator/tests/P_full/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_full/stdout.txt.expect46
-rw-r--r--externals/nnapi_test_generator/tests/P_lstm/lstm.mod.py161
-rw-r--r--externals/nnapi_test_generator/tests/P_lstm/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_lstm/stdout.txt.expect75
-rw-r--r--externals/nnapi_test_generator/tests/P_quantized_avgpool/averpoolfloat.mod.py20
-rw-r--r--externals/nnapi_test_generator/tests/P_quantized_avgpool/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_quantized_avgpool/stdout.txt.expect48
-rw-r--r--externals/nnapi_test_generator/tests/P_quantized_conv/quantized.mod.py11
-rw-r--r--externals/nnapi_test_generator/tests/P_quantized_conv/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_quantized_conv/stdout.txt.expect40
-rw-r--r--externals/nnapi_test_generator/tests/P_vts_full/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_vts_full/stdout.txt.expect93
-rw-r--r--externals/nnapi_test_generator/tests/P_vts_full/vts_full.mod.py19
-rw-r--r--externals/nnapi_test_generator/tests/P_vts_operands/addfloat.mod.py12
-rw-r--r--externals/nnapi_test_generator/tests/P_vts_operands/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_vts_operands/stdout.txt.expect103
-rw-r--r--externals/nnapi_test_generator/tests/P_weird/stderr.txt.expect2
-rw-r--r--externals/nnapi_test_generator/tests/P_weird/stdout.txt.expect51
-rw-r--r--externals/nnapi_test_generator/tests/P_weird/weird_add.mod.py29
-rwxr-xr-xexternals/nnapi_test_generator/tests/test.py328
34 files changed, 0 insertions, 1245 deletions
diff --git a/externals/nnapi_test_generator/tests/P_conv/conv_1_h3_w2_SAME.mod.py b/externals/nnapi_test_generator/tests/P_conv/conv_1_h3_w2_SAME.mod.py
deleted file mode 100644
index 8e93749e2..000000000
--- a/externals/nnapi_test_generator/tests/P_conv/conv_1_h3_w2_SAME.mod.py
+++ /dev/null
@@ -1,11 +0,0 @@
-i4 = Int32Scalar("b4", 1)
-i5 = Int32Scalar("b5", 1)
-i6 = Int32Scalar("b6", 1)
-i7 = Int32Scalar("b7", 0)
-i2 = Input("op2", "TENSOR_FLOAT32", "{1, 8, 8, 3}") # input 0
-i3 = Output("op3", "TENSOR_FLOAT32", "{1, 8, 8, 1}") # output 0
-i0 = Parameter("op0", "TENSOR_FLOAT32", "{1, 3, 2, 3}", [-0.966213, -0.467474, -0.82203, -0.579455, 0.0278809, -0.79946, -0.684259, 0.563238, 0.37289, 0.738216, 0.386045, -0.917775, 0.184325, -0.270568, 0.82236, 0.0973683, -0.941308, -0.144706]) # parameters
-i1 = Parameter("op1", "TENSOR_FLOAT32", "{1}", [0]) # parameters
-model = Model()
-model = model.Conv(i2, i0, i1, i4, i5, i6, i7).To(i3)
-
diff --git a/externals/nnapi_test_generator/tests/P_conv/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_conv/stderr.txt.expect
deleted file mode 100644
index c5a6e36b9..000000000
--- a/externals/nnapi_test_generator/tests/P_conv/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output CTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_conv/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_conv/stdout.txt.expect
deleted file mode 100644
index 47d92b6b8..000000000
--- a/externals/nnapi_test_generator/tests/P_conv/stdout.txt.expect
+++ /dev/null
@@ -1,41 +0,0 @@
-// Generated file (from: conv_1_h3_w2_SAME.mod.py). Do not edit
-void CreateModel(Model *model) {
- OperandType type0(Type::INT32, {});
- OperandType type3(Type::TENSOR_FLOAT32, {1, 3, 2, 3});
- OperandType type2(Type::TENSOR_FLOAT32, {1, 8, 8, 1});
- OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
- OperandType type4(Type::TENSOR_FLOAT32, {1});
- // Phase 1, operands
- auto b4 = model->addOperand(&type0);
- auto b5 = model->addOperand(&type0);
- auto b6 = model->addOperand(&type0);
- auto b7 = model->addOperand(&type0);
- auto op2 = model->addOperand(&type1);
- auto op3 = model->addOperand(&type2);
- auto op0 = model->addOperand(&type3);
- auto op1 = model->addOperand(&type4);
- // Phase 2, operations
- static int32_t b4_init[] = {1};
- model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
- static int32_t b5_init[] = {1};
- model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
- static int32_t b6_init[] = {1};
- model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
- static int32_t b7_init[] = {0};
- model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
- static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f};
- model->setOperandValue(op0, op0_init, sizeof(float) * 18);
- static float op1_init[] = {0.0f};
- model->setOperandValue(op1, op1_init, sizeof(float) * 1);
- model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
- // Phase 3, inputs and outputs
- model->identifyInputsAndOutputs(
- {op2},
- {op3});
- assert(model->isValid());
-}
-
-bool is_ignored(int i) {
- static std::set<int> ignore = {};
- return ignore.find(i) != ignore.end();
-}
diff --git a/externals/nnapi_test_generator/tests/P_depthwise_conv/depthwise_conv.bin.mod.py b/externals/nnapi_test_generator/tests/P_depthwise_conv/depthwise_conv.bin.mod.py
deleted file mode 100644
index 8738ee01b..000000000
--- a/externals/nnapi_test_generator/tests/P_depthwise_conv/depthwise_conv.bin.mod.py
+++ /dev/null
@@ -1,11 +0,0 @@
-model = Model()
-i4 = Int32Scalar("b4", 1)
-i5 = Int32Scalar("b5", 1)
-i6 = Int32Scalar("b6", 1)
-i7 = Int32Scalar("b7", 1)
-i8 = Int32Scalar("b8", 0)
-i2 = Input("op2", "TENSOR_FLOAT32", "{1, 8, 8, 3}") # input 0
-i3 = Output("op3", "TENSOR_FLOAT32", "{1, 8, 8, 3}") # output 0
-i0 = Parameter("op0", "TENSOR_FLOAT32", "{1, 1, 1, 3}", [-0.966213, -0.467474, -0.82203]) # parameters
-i1 = Parameter("op1", "TENSOR_FLOAT32", "{3}", [0, 0, 0]) # parameters
-model = model.DepthWiseConv(i2, i0, i1, i4, i5, i6, i7, i8).To(i3)
diff --git a/externals/nnapi_test_generator/tests/P_depthwise_conv/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_depthwise_conv/stderr.txt.expect
deleted file mode 100644
index c5a6e36b9..000000000
--- a/externals/nnapi_test_generator/tests/P_depthwise_conv/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output CTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_depthwise_conv/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_depthwise_conv/stdout.txt.expect
deleted file mode 100644
index 9a22cc3e3..000000000
--- a/externals/nnapi_test_generator/tests/P_depthwise_conv/stdout.txt.expect
+++ /dev/null
@@ -1,43 +0,0 @@
-// Generated file (from: depthwise_conv.bin.mod.py). Do not edit
-void CreateModel(Model *model) {
- OperandType type0(Type::INT32, {});
- OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 3});
- OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
- OperandType type3(Type::TENSOR_FLOAT32, {3});
- // Phase 1, operands
- auto b4 = model->addOperand(&type0);
- auto b5 = model->addOperand(&type0);
- auto b6 = model->addOperand(&type0);
- auto b7 = model->addOperand(&type0);
- auto b8 = model->addOperand(&type0);
- auto op2 = model->addOperand(&type1);
- auto op3 = model->addOperand(&type1);
- auto op0 = model->addOperand(&type2);
- auto op1 = model->addOperand(&type3);
- // Phase 2, operations
- static int32_t b4_init[] = {1};
- model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
- static int32_t b5_init[] = {1};
- model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
- static int32_t b6_init[] = {1};
- model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
- static int32_t b7_init[] = {1};
- model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
- static int32_t b8_init[] = {0};
- model->setOperandValue(b8, b8_init, sizeof(int32_t) * 1);
- static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f};
- model->setOperandValue(op0, op0_init, sizeof(float) * 3);
- static float op1_init[] = {0.0f, 0.0f, 0.0f};
- model->setOperandValue(op1, op1_init, sizeof(float) * 3);
- model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op2, op0, op1, b4, b5, b6, b7, b8}, {op3});
- // Phase 3, inputs and outputs
- model->identifyInputsAndOutputs(
- {op2},
- {op3});
- assert(model->isValid());
-}
-
-bool is_ignored(int i) {
- static std::set<int> ignore = {};
- return ignore.find(i) != ignore.end();
-}
diff --git a/externals/nnapi_test_generator/tests/P_explicit/explicit_add.mod.py b/externals/nnapi_test_generator/tests/P_explicit/explicit_add.mod.py
deleted file mode 100644
index b1c8f99a4..000000000
--- a/externals/nnapi_test_generator/tests/P_explicit/explicit_add.mod.py
+++ /dev/null
@@ -1,7 +0,0 @@
-i1 = Input("op1", "TENSOR_FLOAT32", "{1, 8, 8, 3}") # input 0
-i2 = Output("op2", "TENSOR_FLOAT32", "{1, 8, 8, 3}") # output 0
-i0 = Internal("op0", "TENSOR_FLOAT32", "{1, 8, 8, 3}") # intermediate result
-model = Model()
-model = model.RawAdd(i1, i1).To(i0)
-model = model.RawAdd(i0, i1).To(i2)
-
diff --git a/externals/nnapi_test_generator/tests/P_explicit/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_explicit/stderr.txt.expect
deleted file mode 100644
index c5a6e36b9..000000000
--- a/externals/nnapi_test_generator/tests/P_explicit/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output CTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_explicit/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_explicit/stdout.txt.expect
deleted file mode 100644
index 1221b7bda..000000000
--- a/externals/nnapi_test_generator/tests/P_explicit/stdout.txt.expect
+++ /dev/null
@@ -1,21 +0,0 @@
-// Generated file (from: explicit_add.mod.py). Do not edit
-void CreateModel(Model *model) {
- OperandType type0(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
- // Phase 1, operands
- auto op1 = model->addOperand(&type0);
- auto op2 = model->addOperand(&type0);
- auto op0 = model->addOperand(&type0);
- // Phase 2, operations
- model->addOperation(ANEURALNETWORKS_ADD, {op1, op1}, {op0});
- model->addOperation(ANEURALNETWORKS_ADD, {op0, op1}, {op2});
- // Phase 3, inputs and outputs
- model->identifyInputsAndOutputs(
- {op1},
- {op2});
- assert(model->isValid());
-}
-
-bool is_ignored(int i) {
- static std::set<int> ignore = {};
- return ignore.find(i) != ignore.end();
-}
diff --git a/externals/nnapi_test_generator/tests/P_float/addfloat.mod.py b/externals/nnapi_test_generator/tests/P_float/addfloat.mod.py
deleted file mode 100644
index f0e4f0430..000000000
--- a/externals/nnapi_test_generator/tests/P_float/addfloat.mod.py
+++ /dev/null
@@ -1,8 +0,0 @@
-# model
-i1 = Input("operand1","TENSOR_FLOAT32", "{3,4}")
-i2 = Input("operand2","TENSOR_FLOAT32", "{3,4}")
-i3 = Input("operand3","TENSOR_FLOAT32", "{3,4}")
-o = Output("operand4","TENSOR_FLOAT32", "{3,4}")
-
-Model().Add(i1, i2).Add(i3).Out(o)
-
diff --git a/externals/nnapi_test_generator/tests/P_float/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_float/stderr.txt.expect
deleted file mode 100644
index c5a6e36b9..000000000
--- a/externals/nnapi_test_generator/tests/P_float/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output CTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_float/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_float/stdout.txt.expect
deleted file mode 100644
index eb8cc146b..000000000
--- a/externals/nnapi_test_generator/tests/P_float/stdout.txt.expect
+++ /dev/null
@@ -1,23 +0,0 @@
-// Generated file (from: addfloat.mod.py). Do not edit
-void CreateModel(Model *model) {
- OperandType type0(Type::TENSOR_FLOAT32, {3,4});
- // Phase 1, operands
- auto operand1 = model->addOperand(&type0);
- auto operand2 = model->addOperand(&type0);
- auto operand3 = model->addOperand(&type0);
- auto operand4 = model->addOperand(&type0);
- auto tmp4 = model->addOperand(&type0);
- // Phase 2, operations
- model->addOperation(ANEURALNETWORKS_ADD, {operand1, operand2}, {tmp4});
- model->addOperation(ANEURALNETWORKS_ADD, {operand3, tmp4}, {operand4});
- // Phase 3, inputs and outputs
- model->identifyInputsAndOutputs(
- {operand1, operand2, operand3},
- {operand4});
- assert(model->isValid());
-}
-
-bool is_ignored(int i) {
- static std::set<int> ignore = {};
- return ignore.find(i) != ignore.end();
-}
diff --git a/externals/nnapi_test_generator/tests/P_full/addfloat.mod.py b/externals/nnapi_test_generator/tests/P_full/addfloat.mod.py
deleted file mode 100644
index dbe7701a1..000000000
--- a/externals/nnapi_test_generator/tests/P_full/addfloat.mod.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# model
-model = Model()
-i1 = Input("op1", "TENSOR_FLOAT32", "{2}") # a vector of 2 float32s
-i2 = Input("op2", "TENSOR_FLOAT32", "{2}") # another vector of 2 float32s
-b0 = Int32Scalar("b0", 0) # an int32_t scalar bias
-i3 = Output("op3", "TENSOR_FLOAT32", "{2}")
-model = model.Operation("ADD", i1, i2, b0).To(i3)
-
-# Example 1. Input in operand 0,
-input0 = {i1: # input 0
- [1.0, 2.0],
- i2: # input 1
- [3.0, 4.0]}
-
-output0 = {i3: # output 0
- [4.0, 6.0]}
-
-# Instantiate an example
-Example((input0, output0))
-
-
-
diff --git a/externals/nnapi_test_generator/tests/P_full/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_full/stderr.txt.expect
deleted file mode 100644
index c5a6e36b9..000000000
--- a/externals/nnapi_test_generator/tests/P_full/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output CTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_full/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_full/stdout.txt.expect
deleted file mode 100644
index e3d2af3fa..000000000
--- a/externals/nnapi_test_generator/tests/P_full/stdout.txt.expect
+++ /dev/null
@@ -1,46 +0,0 @@
-// Generated file (from: addfloat.mod.py). Do not edit
-void CreateModel(Model *model) {
- OperandType type1(Type::INT32, {});
- OperandType type0(Type::TENSOR_FLOAT32, {2});
- // Phase 1, operands
- auto op1 = model->addOperand(&type0);
- auto op2 = model->addOperand(&type0);
- auto b0 = model->addOperand(&type1);
- auto op3 = model->addOperand(&type0);
- // Phase 2, operations
- static int32_t b0_init[] = {0};
- model->setOperandValue(b0, b0_init, sizeof(int32_t) * 1);
- model->addOperation(ANEURALNETWORKS_ADD, {op1, op2, b0}, {op3});
- // Phase 3, inputs and outputs
- model->identifyInputsAndOutputs(
- {op1, op2},
- {op3});
- assert(model->isValid());
-}
-
-bool is_ignored(int i) {
- static std::set<int> ignore = {};
- return ignore.find(i) != ignore.end();
-}
-// Generated file (from: addfloat.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}}, {1, {3.0f, 4.0f}}},
- // int -> INT32 map
- {},
- // int -> QUANT8_ASYMM map
- {}
-},
-//Output(s)
-{ // See tools/test_generator/include/TestHarness.h:MixedTyped
- // int -> FLOAT32 map
- {{0, {4.0f, 6.0f}}},
- // int -> INT32 map
- {},
- // int -> QUANT8_ASYMM map
- {}
-}
-}, // End of an example
diff --git a/externals/nnapi_test_generator/tests/P_lstm/lstm.mod.py b/externals/nnapi_test_generator/tests/P_lstm/lstm.mod.py
deleted file mode 100644
index cb1bf6010..000000000
--- a/externals/nnapi_test_generator/tests/P_lstm/lstm.mod.py
+++ /dev/null
@@ -1,161 +0,0 @@
-#
-# Copyright (C) 2017 The Android Open Source Project
-#
-# 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.
-#
-
-# LSTM Test: No Cifg, No Peephole, No Projection, and No Clipping.
-
-model = Model()
-
-n_batch = 1
-n_input = 2
-# n_cell and n_output have the same size when there is no projection.
-n_cell = 4
-n_output = 4
-
-input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_input))
-
-input_to_input_weights = Input("input_to_input_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
-input_to_forget_weights = Input("input_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
-input_to_cell_weights = Input("input_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
-input_to_output_weights = Input("input_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
-
-recurrent_to_input_weights = Input("recurrent_to_intput_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
-recurrent_to_forget_weights = Input("recurrent_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
-recurrent_to_cell_weights = Input("recurrent_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
-recurrent_to_output_weights = Input("recurrent_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
-
-cell_to_input_weights = Input("cell_to_input_weights", "TENSOR_FLOAT32", "{0}")
-cell_to_forget_weights = Input("cell_to_forget_weights", "TENSOR_FLOAT32", "{0}")
-cell_to_output_weights = Input("cell_to_output_weights", "TENSOR_FLOAT32", "{0}")
-
-input_gate_bias = Input("input_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
-forget_gate_bias = Input("forget_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
-cell_gate_bias = Input("cell_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
-output_gate_bias = Input("output_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
-
-projection_weights = Input("projection_weights", "TENSOR_FLOAT32", "{0,0}")
-projection_bias = Input("projection_bias", "TENSOR_FLOAT32", "{0}")
-
-output_state_in = Input("output_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
-cell_state_in = Input("cell_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
-
-activation_param = Input("activation_param", "TENSOR_INT32", "{1}")
-cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
-proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
-
-scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, (n_cell * 4)))
-output_state_out = IgnoredOutput("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
-cell_state_out = IgnoredOutput("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
-output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
-
-model = model.Operation("LSTM",
- input,
-
- input_to_input_weights,
- input_to_forget_weights,
- input_to_cell_weights,
- input_to_output_weights,
-
- recurrent_to_input_weights,
- recurrent_to_forget_weights,
- recurrent_to_cell_weights,
- recurrent_to_output_weights,
-
- cell_to_input_weights,
- cell_to_forget_weights,
- cell_to_output_weights,
-
- input_gate_bias,
- forget_gate_bias,
- cell_gate_bias,
- output_gate_bias,
-
- projection_weights,
- projection_bias,
-
- output_state_in,
- cell_state_in,
-
- activation_param,
- cell_clip_param,
- proj_clip_param
-).To([scratch_buffer, output_state_out, cell_state_out, output])
-
-# Example 1. Input in operand 0,
-input0 = {input_to_input_weights: [-0.45018822, -0.02338299, -0.0870589, -0.34550029, 0.04266912, -0.15680569, -0.34856534, 0.43890524],
- input_to_forget_weights: [0.09701663, 0.20334584, -0.50592935, -0.31343272, -0.40032279, 0.44781327, 0.01387155, -0.35593212],
- input_to_cell_weights: [-0.50013041, 0.1370284, 0.11810488, 0.2013163, -0.20583314, 0.44344562, 0.22077113, -0.29909778],
- input_to_output_weights: [-0.25065863, -0.28290087, 0.04613829, 0.40525138, 0.44272184, 0.03897077, -0.1556896, 0.19487578],
-
- input_gate_bias: [0.,0.,0.,0.],
- forget_gate_bias: [1.,1.,1.,1.],
- cell_gate_bias: [0.,0.,0.,0.],
- output_gate_bias: [0.,0.,0.,0.],
-
- recurrent_to_input_weights: [
- -0.0063535, -0.2042388, 0.31454784, -0.35746509, 0.28902304, 0.08183324,
- -0.16555229, 0.02286911, -0.13566875, 0.03034258, 0.48091322,
- -0.12528998, 0.24077177, -0.51332325, -0.33502164, 0.10629296],
-
- recurrent_to_cell_weights: [
- -0.3407414, 0.24443203, -0.2078532, 0.26320225, 0.05695659, -0.00123841,
- -0.4744786, -0.35869038, -0.06418842, -0.13502428, -0.501764, 0.22830659,
- -0.46367589, 0.26016325, -0.03894562, -0.16368064],
-
- recurrent_to_forget_weights: [
- -0.48684245, -0.06655136, 0.42224967, 0.2112639, 0.27654213, 0.20864892,
- -0.07646349, 0.45877004, 0.00141793, -0.14609534, 0.36447752, 0.09196436,
- 0.28053468, 0.01560611, -0.20127171, -0.01140004],
-
- recurrent_to_output_weights: [
- 0.43385774, -0.17194885, 0.2718237, 0.09215671, 0.24107647, -0.39835793,
- 0.18212086, 0.01301402, 0.48572797, -0.50656658, 0.20047462, -0.20607421,
- -0.51818722, -0.15390486, 0.0468148, 0.39922136],
-
- cell_to_input_weights: [],
- cell_to_forget_weights: [],
- cell_to_output_weights: [],
-
- projection_weights: [],
- projection_bias: [],
-
- activation_param: [4], # Tanh
- cell_clip_param: [0.],
- proj_clip_param: [0.],
-}
-
-# Instantiate examples
-# TODO: Add more examples after fixing the reference issue
-test_inputs = [
- [2., 3.],
-# [3., 4.],[1., 1.]
-]
-golden_outputs = [
- [-0.02973187, 0.1229473, 0.20885126, -0.15358765,],
-# [-0.03716109, 0.12507336, 0.41193449, -0.20860538],
-# [-0.15053082, 0.09120187, 0.24278517, -0.12222792]
-]
-
-for (input_tensor, output_tensor) in zip(test_inputs, golden_outputs):
- output0 = {
- scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
- cell_state_out: [ 0 for x in range(n_batch * n_cell) ],
- output_state_out: [ 0 for x in range(n_batch * n_output) ],
- output: output_tensor
- }
- input0[input] = input_tensor
- input0[output_state_in] = [ 0 for _ in range(n_batch * n_output) ]
- input0[cell_state_in] = [ 0 for _ in range(n_batch * n_cell) ]
- Example((input0, output0))
diff --git a/externals/nnapi_test_generator/tests/P_lstm/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_lstm/stderr.txt.expect
deleted file mode 100644
index c5a6e36b9..000000000
--- a/externals/nnapi_test_generator/tests/P_lstm/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output CTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_lstm/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_lstm/stdout.txt.expect
deleted file mode 100644
index 2ba320d77..000000000
--- a/externals/nnapi_test_generator/tests/P_lstm/stdout.txt.expect
+++ /dev/null
@@ -1,75 +0,0 @@
-// Generated file (from: lstm.mod.py). Do not edit
-void CreateModel(Model *model) {
- OperandType type5(Type::TENSOR_FLOAT32, {0,0});
- OperandType type3(Type::TENSOR_FLOAT32, {0});
- OperandType type9(Type::TENSOR_FLOAT32, {1, 16});
- OperandType type0(Type::TENSOR_FLOAT32, {1, 2});
- OperandType type6(Type::TENSOR_FLOAT32, {1, 4});
- OperandType type8(Type::TENSOR_FLOAT32, {1});
- OperandType type1(Type::TENSOR_FLOAT32, {4, 2});
- OperandType type2(Type::TENSOR_FLOAT32, {4, 4});
- OperandType type4(Type::TENSOR_FLOAT32, {4});
- OperandType type7(Type::TENSOR_INT32, {1});
- // Phase 1, operands
- auto input = model->addOperand(&type0);
- auto input_to_input_weights = model->addOperand(&type1);
- auto input_to_forget_weights = model->addOperand(&type1);
- auto input_to_cell_weights = model->addOperand(&type1);
- auto input_to_output_weights = model->addOperand(&type1);
- auto recurrent_to_intput_weights = model->addOperand(&type2);
- auto recurrent_to_forget_weights = model->addOperand(&type2);
- auto recurrent_to_cell_weights = model->addOperand(&type2);
- auto recurrent_to_output_weights = model->addOperand(&type2);
- auto cell_to_input_weights = model->addOperand(&type3);
- auto cell_to_forget_weights = model->addOperand(&type3);
- auto cell_to_output_weights = model->addOperand(&type3);
- auto input_gate_bias = model->addOperand(&type4);
- auto forget_gate_bias = model->addOperand(&type4);
- auto cell_gate_bias = model->addOperand(&type4);
- auto output_gate_bias = model->addOperand(&type4);
- auto projection_weights = model->addOperand(&type5);
- auto projection_bias = model->addOperand(&type3);
- auto output_state_in = model->addOperand(&type6);
- auto cell_state_in = model->addOperand(&type6);
- auto activation_param = model->addOperand(&type7);
- auto cell_clip_param = model->addOperand(&type8);
- auto proj_clip_param = model->addOperand(&type8);
- auto scratch_buffer = model->addOperand(&type9);
- auto output_state_out = model->addOperand(&type6);
- auto cell_state_out = model->addOperand(&type6);
- auto output = model->addOperand(&type6);
- // Phase 2, operations
- model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param}, {scratch_buffer, output_state_out, cell_state_out, output});
- // Phase 3, inputs and outputs
- model->identifyInputsAndOutputs(
- {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param},
- {scratch_buffer, output_state_out, cell_state_out, output});
- assert(model->isValid());
-}
-
-bool is_ignored(int i) {
- static std::set<int> ignore = {1, 2, 0};
- return ignore.find(i) != ignore.end();
-}
-// Generated file (from: lstm.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.0f}}, {1, {-0.45018822f, -0.02338299f, -0.0870589f, -0.34550029f, 0.04266912f, -0.15680569f, -0.34856534f, 0.43890524f}}, {2, {0.09701663f, 0.20334584f, -0.50592935f, -0.31343272f, -0.40032279f, 0.44781327f, 0.01387155f, -0.35593212f}}, {3, {-0.50013041f, 0.1370284f, 0.11810488f, 0.2013163f, -0.20583314f, 0.44344562f, 0.22077113f, -0.29909778f}}, {4, {-0.25065863f, -0.28290087f, 0.04613829f, 0.40525138f, 0.44272184f, 0.03897077f, -0.1556896f, 0.19487578f}}, {5, {-0.0063535f, -0.2042388f, 0.31454784f, -0.35746509f, 0.28902304f, 0.08183324f, -0.16555229f, 0.02286911f, -0.13566875f, 0.03034258f, 0.48091322f, -0.12528998f, 0.24077177f, -0.51332325f, -0.33502164f, 0.10629296f}}, {6, {-0.48684245f, -0.06655136f, 0.42224967f, 0.2112639f, 0.27654213f, 0.20864892f, -0.07646349f, 0.45877004f, 0.00141793f, -0.14609534f, 0.36447752f, 0.09196436f, 0.28053468f, 0.01560611f, -0.20127171f, -0.01140004f}}, {7, {-0.3407414f, 0.24443203f, -0.2078532f, 0.26320225f, 0.05695659f, -0.00123841f, -0.4744786f, -0.35869038f, -0.06418842f, -0.13502428f, -0.501764f, 0.22830659f, -0.46367589f, 0.26016325f, -0.03894562f, -0.16368064f}}, {8, {0.43385774f, -0.17194885f, 0.2718237f, 0.09215671f, 0.24107647f, -0.39835793f, 0.18212086f, 0.01301402f, 0.48572797f, -0.50656658f, 0.20047462f, -0.20607421f, -0.51818722f, -0.15390486f, 0.0468148f, 0.39922136f}}, {9, {}}, {10, {}}, {11, {}}, {12, {0.0f, 0.0f, 0.0f, 0.0f}}, {13, {1.0f, 1.0f, 1.0f, 1.0f}}, {14, {0.0f, 0.0f, 0.0f, 0.0f}}, {15, {0.0f, 0.0f, 0.0f, 0.0f}}, {16, {}}, {17, {}}, {18, {0, 0, 0, 0}}, {19, {0, 0, 0, 0}}, {21, {0.0f}}, {22, {0.0f}}},
- // int -> INT32 map
- {{20, {4}}},
- // int -> QUANT8_ASYMM map
- {}
-},
-//Output(s)
-{ // See tools/test_generator/include/TestHarness.h:MixedTyped
- // int -> FLOAT32 map
- {{1, {0, 0, 0, 0}}, {2, {0, 0, 0, 0}}, {3, {-0.02973187f, 0.1229473f, 0.20885126f, -0.15358765f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
- // int -> INT32 map
- {},
- // int -> QUANT8_ASYMM map
- {}
-}
-}, // End of an example
diff --git a/externals/nnapi_test_generator/tests/P_quantized_avgpool/averpoolfloat.mod.py b/externals/nnapi_test_generator/tests/P_quantized_avgpool/averpoolfloat.mod.py
deleted file mode 100644
index 17d6e0a4f..000000000
--- a/externals/nnapi_test_generator/tests/P_quantized_avgpool/averpoolfloat.mod.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# model
-model = Model()
-i1 = Input("op1", "TENSOR_QUANT8_ASYMM", "0.0f, 127.5f, {1, 2, 2, 1}")
-cons1 = Int32Scalar("cons1", 1)
-act = Int32Scalar("act", 0)
-o = Output("op3", "TENSOR_QUANT8_ASYMM", "0.0f, 127.5f, {1, 2, 2, 1}")
-model = model.Operation("AVERAGE_POOL", i1, cons1, cons1, cons1, cons1, cons1, act).To(o)
-
-# Example 1. Input in operand 0,
-input0 = {i1: # input 0
- [1, 2, 3, 4]}
-
-output0 = {o: # output 0
- [1, 2, 3, 4]}
-
-# Instantiate an example
-Example((input0, output0))
-
-
-
diff --git a/externals/nnapi_test_generator/tests/P_quantized_avgpool/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_quantized_avgpool/stderr.txt.expect
deleted file mode 100644
index c5a6e36b9..000000000
--- a/externals/nnapi_test_generator/tests/P_quantized_avgpool/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output CTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_quantized_avgpool/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_quantized_avgpool/stdout.txt.expect
deleted file mode 100644
index b4632d34d..000000000
--- a/externals/nnapi_test_generator/tests/P_quantized_avgpool/stdout.txt.expect
+++ /dev/null
@@ -1,48 +0,0 @@
-// Generated file (from: averpoolfloat.mod.py). Do not edit
-void CreateModel(Model *model) {
- OperandType type1(Type::INT32, {});
- OperandType type0(Type::TENSOR_QUANT8_ASYMM, 0.0f, 127.5f, {1, 2, 2, 1});
- // Phase 1, operands
- auto op1 = model->addOperand(&type0);
- auto cons1 = model->addOperand(&type1);
- auto act = model->addOperand(&type1);
- auto op3 = model->addOperand(&type0);
- // Phase 2, operations
- static int32_t cons1_init[] = {1};
- model->setOperandValue(cons1, cons1_init, sizeof(int32_t) * 1);
- static int32_t act_init[] = {0};
- model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
- model->addOperation(ANEURALNETWORKS_AVERAGE_POOL, {op1, cons1, cons1, cons1, cons1, cons1, act}, {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();
-}
-// Generated file (from: averpoolfloat.mod.py). Do not edit
-// Begin of an example
-{
-//Input(s)
-{ // See tools/test_generator/include/TestHarness.h:MixedTyped
- // int -> FLOAT32 map
- {},
- // int -> INT32 map
- {},
- // int -> QUANT8_ASYMM map
- {{0, {1, 2, 3, 4}}}
-},
-//Output(s)
-{ // See tools/test_generator/include/TestHarness.h:MixedTyped
- // int -> FLOAT32 map
- {},
- // int -> INT32 map
- {},
- // int -> QUANT8_ASYMM map
- {{0, {1, 2, 3, 4}}}
-}
-}, // End of an example
diff --git a/externals/nnapi_test_generator/tests/P_quantized_conv/quantized.mod.py b/externals/nnapi_test_generator/tests/P_quantized_conv/quantized.mod.py
deleted file mode 100644
index 7ef623513..000000000
--- a/externals/nnapi_test_generator/tests/P_quantized_conv/quantized.mod.py
+++ /dev/null
@@ -1,11 +0,0 @@
-i4 = Int32Scalar("b4", 2)
-i5 = Int32Scalar("b5", 2)
-i6 = Int32Scalar("b6", 2)
-i7 = Int32Scalar("b7", 0)
-i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}") # input 0
-i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{1, 1, 1, 1}") # output 0
-i0 = Parameter("op0", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}", [1, 1, 1, 1]) # parameters
-i1 = Parameter("op1", "TENSOR_INT32", "{1}", [0]) # parameters
-model = Model()
-model = model.Conv(i2, i0, i1, i4, i5, i6, i7).To(i3)
-
diff --git a/externals/nnapi_test_generator/tests/P_quantized_conv/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_quantized_conv/stderr.txt.expect
deleted file mode 100644
index c5a6e36b9..000000000
--- a/externals/nnapi_test_generator/tests/P_quantized_conv/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output CTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_quantized_conv/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_quantized_conv/stdout.txt.expect
deleted file mode 100644
index 6b28bdd54..000000000
--- a/externals/nnapi_test_generator/tests/P_quantized_conv/stdout.txt.expect
+++ /dev/null
@@ -1,40 +0,0 @@
-// Generated file (from: quantized.mod.py). Do not edit
-void CreateModel(Model *model) {
- OperandType type0(Type::INT32, {});
- OperandType type3(Type::TENSOR_INT32, {1});
- OperandType type2(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1});
- OperandType type1(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1});
- // Phase 1, operands
- auto b4 = model->addOperand(&type0);
- auto b5 = model->addOperand(&type0);
- auto b6 = model->addOperand(&type0);
- auto b7 = model->addOperand(&type0);
- auto op2 = model->addOperand(&type1);
- auto op3 = model->addOperand(&type2);
- auto op0 = model->addOperand(&type1);
- auto op1 = model->addOperand(&type3);
- // Phase 2, operations
- static int32_t b4_init[] = {2};
- model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
- static int32_t b5_init[] = {2};
- model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
- static int32_t b6_init[] = {2};
- model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
- static int32_t b7_init[] = {0};
- model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
- static uint8_t op0_init[] = {1, 1, 1, 1};
- model->setOperandValue(op0, op0_init, sizeof(uint8_t) * 4);
- static int32_t op1_init[] = {0};
- model->setOperandValue(op1, op1_init, sizeof(int32_t) * 1);
- model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
- // Phase 3, inputs and outputs
- model->identifyInputsAndOutputs(
- {op2},
- {op3});
- assert(model->isValid());
-}
-
-bool is_ignored(int i) {
- static std::set<int> ignore = {};
- return ignore.find(i) != ignore.end();
-}
diff --git a/externals/nnapi_test_generator/tests/P_vts_full/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_vts_full/stderr.txt.expect
deleted file mode 100644
index 3decb4c1c..000000000
--- a/externals/nnapi_test_generator/tests/P_vts_full/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output VTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_vts_full/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_vts_full/stdout.txt.expect
deleted file mode 100644
index 14cd4f99d..000000000
--- a/externals/nnapi_test_generator/tests/P_vts_full/stdout.txt.expect
+++ /dev/null
@@ -1,93 +0,0 @@
-// Generated code. Do not edit
-// Create the model
-Model createTestModel() {
- const std::vector<Operand> operands = {
- {
- .type = OperandType::TENSOR_FLOAT32,
- .dimensions = {1, 2, 2, 1},
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::MODEL_INPUT,
- .location = {.poolIndex = 0, .offset = 0, .length = 0},
- },
- {
- .type = OperandType::INT32,
- .dimensions = {},
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::CONSTANT_COPY,
- .location = {.poolIndex = 0, .offset = 0, .length = 4},
- },
- {
- .type = OperandType::TENSOR_FLOAT32,
- .dimensions = {1, 2, 2, 1},
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::CONSTANT_COPY,
- .location = {.poolIndex = 0, .offset = 4, .length = 16},
- },
- {
- .type = OperandType::TENSOR_FLOAT32,
- .dimensions = {1, 2, 2, 1},
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::MODEL_OUTPUT,
- .location = {.poolIndex = 0, .offset = 0, .length = 0},
- }
- };
-
- const std::vector<Operation> operations = {
- {
- .type = OperationType::ADD,
- .inputs = {0, 2, 1},
- .outputs = {3},
- }
- };
-
- const std::vector<uint32_t> inputIndexes = {0};
- const std::vector<uint32_t> outputIndexes = {3};
- std::vector<uint8_t> operandValues = {
- 0, 0, 0, 0, 0, 0, 160, 64, 0, 0, 192, 64, 0, 0, 224, 64, 0, 0, 0, 65
- };
- const std::vector<hidl_memory> pools = {};
-
- return {
- .operands = operands,
- .operations = operations,
- .inputIndexes = inputIndexes,
- .outputIndexes = outputIndexes,
- .operandValues = operandValues,
- .pools = pools,
- };
-}
-
-bool is_ignored(int i) {
- static std::set<int> ignore = {};
- return ignore.find(i) != ignore.end();
-}
-// Generated file (from: vts_full.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, 3.0f, 4.0f}}},
- // int -> INT32 map
- {},
- // int -> QUANT8_ASYMM map
- {}
-},
-//Output(s)
-{ // See tools/test_generator/include/TestHarness.h:MixedTyped
- // int -> FLOAT32 map
- {{0, {6.0f, 8.0f, 10.0f, 12.0f}}},
- // int -> INT32 map
- {},
- // int -> QUANT8_ASYMM map
- {}
-}
-}, // End of an example
diff --git a/externals/nnapi_test_generator/tests/P_vts_full/vts_full.mod.py b/externals/nnapi_test_generator/tests/P_vts_full/vts_full.mod.py
deleted file mode 100644
index 4ad3b2e4b..000000000
--- a/externals/nnapi_test_generator/tests/P_vts_full/vts_full.mod.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Force VTS mode
-Configuration.vts = True
-# model
-model = Model()
-i0 = Input("operand0","TENSOR_FLOAT32", "{1, 2, 2, 1}")
-b0 = Int32Scalar("b0", 0)
-p0 = Parameter("p0", "TENSOR_FLOAT32", "{1, 2, 2, 1}", [5.0, 6.0, 7.0, 8.0])
-o = Output("out","TENSOR_FLOAT32", "{1, 2, 2, 1}")
-
-model.Operation("ADD", i0, p0, b0).To(o)
-
-input0 = {i0: # input 0
- [1.0, 2.0, 3.0, 4.0]}
-
-output0 = {o: # output 0
- [6.0, 8.0, 10.0, 12.0]}
-
-# Instantiate an example
-Example((input0, output0))
diff --git a/externals/nnapi_test_generator/tests/P_vts_operands/addfloat.mod.py b/externals/nnapi_test_generator/tests/P_vts_operands/addfloat.mod.py
deleted file mode 100644
index 976cb35ec..000000000
--- a/externals/nnapi_test_generator/tests/P_vts_operands/addfloat.mod.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Force VTS mode
-Configuration.vts = True
-# model
-i1 = Input("operand1","TENSOR_FLOAT32", "{3,4}")
-i2 = Input("operand2","TENSOR_FLOAT32", "{3,4}")
-i3 = Input("operand3","TENSOR_FLOAT32", "{3,4}")
-Parameter("p1", "TENSOR_QUANT8_ASYMM", "{1, 2, 3}", [1, 2, 3, 4, 5, 6])
-Parameter("p2", "TENSOR_FLOAT32", "{}", [42.0])
-o = Output("operand4","TENSOR_FLOAT32", "{3,4}")
-
-Model().Add(i1, i2).Add(i3).Out(o)
-
diff --git a/externals/nnapi_test_generator/tests/P_vts_operands/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_vts_operands/stderr.txt.expect
deleted file mode 100644
index 3decb4c1c..000000000
--- a/externals/nnapi_test_generator/tests/P_vts_operands/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output VTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_vts_operands/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_vts_operands/stdout.txt.expect
deleted file mode 100644
index 2e74d1fc0..000000000
--- a/externals/nnapi_test_generator/tests/P_vts_operands/stdout.txt.expect
+++ /dev/null
@@ -1,103 +0,0 @@
-// Generated code. Do not edit
-// Create the model
-Model createTestModel() {
- const std::vector<Operand> operands = {
- {
- .type = OperandType::TENSOR_FLOAT32,
- .dimensions = {3,4},
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::MODEL_INPUT,
- .location = {.poolIndex = 0, .offset = 0, .length = 0},
- },
- {
- .type = OperandType::TENSOR_FLOAT32,
- .dimensions = {3,4},
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::MODEL_INPUT,
- .location = {.poolIndex = 0, .offset = 0, .length = 0},
- },
- {
- .type = OperandType::TENSOR_FLOAT32,
- .dimensions = {3,4},
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::MODEL_INPUT,
- .location = {.poolIndex = 0, .offset = 0, .length = 0},
- },
- {
- .type = OperandType::TENSOR_QUANT8_ASYMM,
- .dimensions = {1, 2, 3},
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::CONSTANT_COPY,
- .location = {.poolIndex = 0, .offset = 0, .length = 6},
- },
- {
- .type = OperandType::TENSOR_FLOAT32,
- .dimensions = {},
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::CONSTANT_COPY,
- .location = {.poolIndex = 0, .offset = 6, .length = 4},
- },
- {
- .type = OperandType::TENSOR_FLOAT32,
- .dimensions = {3,4},
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::MODEL_OUTPUT,
- .location = {.poolIndex = 0, .offset = 0, .length = 0},
- },
- {
- .type = OperandType::TENSOR_FLOAT32,
- .dimensions = {3,4},
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .zeroPoint = 0,
- .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
- .location = {.poolIndex = 0, .offset = 0, .length = 0},
- }
- };
-
- const std::vector<Operation> operations = {
- {
- .type = OperationType::ADD,
- .inputs = {0, 1},
- .outputs = {6},
- },
- {
- .type = OperationType::ADD,
- .inputs = {2, 6},
- .outputs = {5},
- }
- };
-
- const std::vector<uint32_t> inputIndexes = {0, 1, 2};
- const std::vector<uint32_t> outputIndexes = {5};
- std::vector<uint8_t> operandValues = {
- 1, 2, 3, 4, 5, 6, 0, 0, 40, 66
- };
- const std::vector<hidl_memory> pools = {};
-
- return {
- .operands = operands,
- .operations = operations,
- .inputIndexes = inputIndexes,
- .outputIndexes = outputIndexes,
- .operandValues = operandValues,
- .pools = pools,
- };
-}
-
-bool is_ignored(int i) {
- static std::set<int> ignore = {};
- return ignore.find(i) != ignore.end();
-}
diff --git a/externals/nnapi_test_generator/tests/P_weird/stderr.txt.expect b/externals/nnapi_test_generator/tests/P_weird/stderr.txt.expect
deleted file mode 100644
index c5a6e36b9..000000000
--- a/externals/nnapi_test_generator/tests/P_weird/stderr.txt.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Output CTS model: -
-Output example:-
diff --git a/externals/nnapi_test_generator/tests/P_weird/stdout.txt.expect b/externals/nnapi_test_generator/tests/P_weird/stdout.txt.expect
deleted file mode 100644
index fa67d68ac..000000000
--- a/externals/nnapi_test_generator/tests/P_weird/stdout.txt.expect
+++ /dev/null
@@ -1,51 +0,0 @@
-// Generated file (from: weird_add.mod.py). Do not edit
-void CreateModel(Model *model) {
- OperandType type1(Type::INT32, {});
- OperandType type0(Type::TENSOR_FLOAT32, {2});
- // Phase 1, operands
- auto op1 = model->addOperand(&type0);
- auto op2 = model->addOperand(&type0);
- auto b0 = model->addOperand(&type1);
- auto tmp = model->addOperand(&type0);
- auto tmp2 = model->addOperand(&type0);
- auto op3 = model->addOperand(&type0);
- auto op4 = model->addOperand(&type0);
- // Phase 2, operations
- static int32_t b0_init[] = {0};
- model->setOperandValue(b0, b0_init, sizeof(int32_t) * 1);
- model->addOperation(ANEURALNETWORKS_ADD, {op1, op2, b0}, {tmp});
- model->addOperation(ANEURALNETWORKS_ADD, {tmp, op2, b0}, {tmp2});
- model->addOperation(ANEURALNETWORKS_ADD, {tmp2, op4, b0}, {op3});
- // Phase 3, inputs and outputs
- model->identifyInputsAndOutputs(
- {op1, op2, op4},
- {op3});
- assert(model->isValid());
-}
-
-bool is_ignored(int i) {
- static std::set<int> ignore = {};
- return ignore.find(i) != ignore.end();
-}
-// Generated file (from: weird_add.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}}, {1, {3.0f, 4.0f}}, {2, {5.0f, 6.0f}}},
- // int -> INT32 map
- {},
- // int -> QUANT8_ASYMM map
- {}
-},
-//Output(s)
-{ // See tools/test_generator/include/TestHarness.h:MixedTyped
- // int -> FLOAT32 map
- {{0, {9.0f, 12.0f}}},
- // int -> INT32 map
- {},
- // int -> QUANT8_ASYMM map
- {}
-}
-}, // End of an example
diff --git a/externals/nnapi_test_generator/tests/P_weird/weird_add.mod.py b/externals/nnapi_test_generator/tests/P_weird/weird_add.mod.py
deleted file mode 100644
index a230267a4..000000000
--- a/externals/nnapi_test_generator/tests/P_weird/weird_add.mod.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# model
-model = Model()
-i1 = Input("op1", "TENSOR_FLOAT32", "{2}") # a vector of 2 float32s
-i2 = Input("op2", "TENSOR_FLOAT32", "{2}") # another vector of 2 float32s
-b0 = Int32Scalar("b0", 0) # an int32_t scalar bias
-tmp = Internal("tmp", "TENSOR_FLOAT32", "{2}")
-tmp2 = Internal("tmp2", "TENSOR_FLOAT32", "{2}")
-o3 = Output("op3", "TENSOR_FLOAT32", "{2}")
-i4 = Input("op4", "TENSOR_FLOAT32", "{2}") # another vector of 2 float32s
-model = model.Operation("ADD", i1, i2, b0).To(tmp)
-model = model.Operation("ADD", tmp, i2, b0).To(tmp2)
-model = model.Operation("ADD", tmp2, i4, b0).To(o3)
-
-# Example 1. Input in operand 0,
-input0 = {i1: # input 0
- [1.0, 2.0],
- i2: # input 1
- [3.0, 4.0],
- i4: # input 4
- [5.0, 6.0]}
-
-output0 = {o3: # output 0
- [9.0, 12.0]}
-
-# Instantiate an example
-Example((input0, output0))
-
-
-
diff --git a/externals/nnapi_test_generator/tests/test.py b/externals/nnapi_test_generator/tests/test.py
deleted file mode 100755
index c987cf680..000000000
--- a/externals/nnapi_test_generator/tests/test.py
+++ /dev/null
@@ -1,328 +0,0 @@
-#!/usr/bin/python3
-
-# Copyright 2017, The Android Open Source Project
-#
-# 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.
-
-
-"""NN Model Test Compiler Test.
-
-Runs subdirectories of tests for the test generator/compiler.
-"""
-
-import filecmp
-import glob
-import os
-import re
-import shutil
-import subprocess
-import sys
-import unittest
-
-
-__author__ = 'Android'
-
-
-DOTTED_LINE = '................'
-
-class OrigFile:
- OrigDir = None
-
-class TestGeneratorTests(unittest.TestCase):
- """Class to contain all the unittest test cases.
-
- Tests will be dynamically added to this class as methods.
- No static tests, so this class is initially empty.
-
- """
- pass
-
-
-def GenerateTests(dir_name):
- """Creates a test method that can be added as method to GenerateTests."""
- cwd = os.getcwd()
- def Test(self):
- os.chdir(cwd)
- ExecTest(dir_name, self)
- return Test
-
-
-def AddUnitTests(test_dirs):
- """Adds a test to Tests for each directory in test_dirs."""
-
- for t in test_dirs:
- # Must start with 'test_' according to unittest
- test_name = 'test_%s' % t
- test = GenerateTests(t)
- # Add test as method to TestGeneratorTests with test_name as method name
- setattr(TestGeneratorTests, test_name, test)
-
-
-class Options(object):
- verbose = 0
- cleanup = 1
- update_cts = 0
- zero_return = 0
-
-
-def CompareFiles(actual, expect):
- """Compares actual and expect for equality."""
- if not os.path.isfile(actual):
- if Options.verbose:
- print ('Could not find %s' % actual)
- return False
- if not os.path.isfile(expect):
- if Options.verbose:
- print ('Could not find %s' % expect)
- return False
-
- return filecmp.cmp(actual, expect, False)
-
-
-def CopyIfDifferent(src, dst):
- """Updates dst if it is different from src."""
- if not CompareFiles(src, dst):
- if Options.verbose:
- print ('Copying from %s to %s' % (src, dst))
- shutil.copyfile(src, dst)
-
-
-def GetCommandLineArgs(filename):
- """Extracts command line arguments from first comment line in a file."""
- f = open(filename, 'r')
- line = f.readline()
- f.close()
- if line[0] == '/' and line[1] == '/':
- return line[2:].strip()
- else:
- return ''
-
-
-def ReadFileToStr(filename):
- """Returns contents of file as a str."""
- with open(filename, 'r') as f:
- return f.read()
-
-
-def ReportIfDifferFromExpected(tests, name, file1, file2):
- """Fails tests if file1 and file2 differ."""
- if not CompareFiles(file1, file2):
- if Options.verbose:
- err_message = ('%s is different:\n'
- 'expected:\n%s\n%s%s\n\n'
- 'actual:\n%s\n%s%s\n') % (
- name,
- DOTTED_LINE, ReadFileToStr(file1), DOTTED_LINE,
- DOTTED_LINE, ReadFileToStr(file2), DOTTED_LINE)
- else:
- err_message = '%s is different' % name
- tests.fail(err_message)
-
-
-def GetRSFiles():
- """Returns a list of files in cwd with extension '.rs' or '.fs'."""
- rs_files = glob.glob('*.mod.py')
- rs_files.sort()
- return rs_files
-
-
-def GetOutDir():
- return os.path.abspath(os.path.join(OrigFile.OrigDir, "../"))
-
-
-# Declare/define cache variable for GetOutDir to cache results
-# This way we only need to call subprocesses once to get the directory
-GetOutDir.cache = None
-
-
-def CreateCmd(run_vts):
- """Creates the test command to run for the current test."""
- cmd_string = ('%s/%s_generator.py'
- ) % (GetOutDir(), "test" if not run_vts else "vts")
- base_args = cmd_string.split()
- rs_files = GetRSFiles()
-
- # Extra command line arguments can be placed as // comments at the start of
- # any .rs file. We automatically bundle up all of these extra args and invoke
- # llvm-rs-cc with them.
- extra_args_str = ''
- for rs_file in rs_files:
- extra_args_str += GetCommandLineArgs(rs_file)
- extra_args = extra_args_str.split()
-
- args = base_args + extra_args + rs_files
- return args
-
-def Cleanup():
- """Cleans up the cwd of any tmp files created in current test."""
- try:
- os.remove('stdout.txt')
- os.remove('stderr.txt')
- shutil.rmtree('tmp/')
- except OSError:
- pass
-
-
-def CheckTestResult(dir_name, subprocess_ret, tests, args):
- """Checks the result of the subprocess command to see if it passed/failed.
-
- If dir_name starts with 'F_', then subprocess is expected to fail.
- If it instead succeeded, then this test is failed.
- Vice versa with a dir_name starting with 'P_'.
-
- Args:
- dir_name: name of current directory/test name
- subprocess_ret: return code of subprocess
- tests: unittest, call tests.fail(reason) when failure
- args: the arguments for the command that was run
- """
- if dir_name[0:2] == 'F_':
- if subprocess_ret == 0:
- if Options.verbose:
- err_message = ('Command (%s) passed on invalid input\n'
- 'stdout:\n%s\n%s%s\n') % (
- ' '.join(args),
- DOTTED_LINE, ReadFileToStr('stdout.txt'), DOTTED_LINE
- )
- else:
- err_message = 'Command passed on invalid input'
- tests.fail(err_message)
- elif dir_name[0:2] == 'P_':
- if subprocess_ret != 0:
- if Options.verbose:
- err_message = ('Command (%s) failed on valid input\n'
- 'stderr:\n%s\n%s%s\n') % (
- ' '.join(args),
- DOTTED_LINE, ReadFileToStr('stderr.txt'), DOTTED_LINE
- )
- else:
- err_message = 'Command failed on valid input'
- tests.fail(err_message)
- else:
- tests.fail('Invalid test name: ' + dir_name +
- ', should start with F_ or P_')
-
-
-
-def ExecTest(dir_name, tests):
- """Executes an test generator test from dir_name."""
-
- os.chdir(dir_name)
- stdout_file = open('stdout.txt', 'w+')
- stderr_file = open('stderr.txt', 'w+')
- run_vts = (dir_name[2:5] == 'vts')
- args = CreateCmd(run_vts)
-
- if Options.verbose > 1:
- print ('Executing:', ' '.join(args))
-
- # Execute the command and check the resulting shell return value.
- # All tests that are expected to FAIL have directory names that
- # start with 'F_'. Other tests that are expected to PASS have
- # directory names that start with 'P_'.
- ret = 0
- try:
- ret = subprocess.call(args, stdout=stdout_file, stderr=stderr_file)
- except OSError:
- tests.fail('subprocess.call failed: ' + ' '.join(args))
-
- stdout_file.close()
- stderr_file.close()
-
- CheckTestResult(dir_name, ret, tests, args)
-
- ReportIfDifferFromExpected(tests, 'stdout', 'stdout.txt.expect', 'stdout.txt')
- ReportIfDifferFromExpected(tests, 'stderr', 'stderr.txt.expect', 'stderr.txt')
-
- if Options.cleanup:
- Cleanup()
-
-
-def Usage():
- """Print out usage information."""
- print ('Usage: %s [OPTION]... [TESTNAME]...'
- 'Renderscript Compiler Test Harness\n'
- 'Runs TESTNAMEs (all tests by default)\n'
- 'Available Options:\n'
- ' -h, --help Help message\n'
- ' -n, --no-cleanup Don\'t clean up after running tests\n'
- ' -v, --verbose Verbose output. Enter multiple -v to get more verbose.\n'
- ' -z, --zero-return Return 0 as exit code no matter if tests fail. Required for TreeHugger.\n'
- ) % (sys.argv[0]),
- return
-
-
-def main():
- """Runs the unittest suite.
-
- Parses command line arguments, adds test directories as tests.
-
- Returns:
- 0 if '-z' flag is set.
- Else unittest.main() returns with its own error code.
- """
-
- OrigFile.OrigDir = os.path.dirname(os.path.abspath(__file__))
- # Chdir to the directory this file is in since tests are in this directory
- os.chdir(OrigFile.OrigDir)
- files = []
- for arg in sys.argv[1:]:
- if arg in ('-h', '--help'):
- Usage()
- return 0
- elif arg in ('-n', '--no-cleanup'):
- Options.cleanup = 0
- elif arg in ('-u', '--update-cts'):
- Options.update_cts = 1
- elif arg in ('-v', '--verbose'):
- Options.verbose += 1
- elif arg in ('-z', '--zero-return'):
- Options.zero_return = 1
- else:
- # Test list to run
- if os.path.isdir(arg):
- files.append(arg)
- else:
- print >> sys.stderr, 'Invalid test or option: %s' % arg
- return 1
-
- if not files:
- file_names = os.listdir('.')
- # Test names must start with 'F_' or 'P_'
- # 'F_' tests are expected to fail
- # 'P_' tests are expected to pass
- for f in file_names:
- if os.path.isdir(f) and (f[0:2] == 'F_' or f[0:2] == 'P_'):
- files.append(f)
- files.sort()
-
- AddUnitTests(files)
-
- # verbosity=2 is necessary for PythonUnitTestRunner to parse the results
- # Otherwise verbosity does not matter
- # If Options.zero_return is set, do not let unittest.main() exit
- # This is necessary in TreeHugger to distinguish between failing tests and
- # failing to execute the python script
- # If Options.zero_return is not set, let unittest.main() exit
- # In this case it will return a non-zero code if any tests fail
- unittest_exit = Options.zero_return == 0
- unittest.main(verbosity=2,
- argv=[sys.argv[0]] + ['TestGeneratorTests'],
- exit=unittest_exit)
-
- return 0
-
-
-if __name__ == '__main__':
- sys.exit(main())
-