diff options
Diffstat (limited to 'externals/nnapi_test_generator/tests/P_vts_full')
3 files changed, 114 insertions, 0 deletions
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 new file mode 100644 index 000000000..3decb4c1c --- /dev/null +++ b/externals/nnapi_test_generator/tests/P_vts_full/stderr.txt.expect @@ -0,0 +1,2 @@ +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 new file mode 100644 index 000000000..14cd4f99d --- /dev/null +++ b/externals/nnapi_test_generator/tests/P_vts_full/stdout.txt.expect @@ -0,0 +1,93 @@ +// 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 new file mode 100644 index 000000000..4ad3b2e4b --- /dev/null +++ b/externals/nnapi_test_generator/tests/P_vts_full/vts_full.mod.py @@ -0,0 +1,19 @@ +# 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)) |