diff options
author | Chunseok Lee <chunseok.lee@samsung.com> | 2020-03-05 15:10:09 +0900 |
---|---|---|
committer | Chunseok Lee <chunseok.lee@samsung.com> | 2020-03-05 15:22:53 +0900 |
commit | d91a039e0eda6fd70dcd22672b8ce1817c1ca50e (patch) | |
tree | 62668ec548cf31fadbbf4e99522999ad13434a25 /tests/nnapi/nnapi_test_generator/android-q-beta/tests/P_vts_naming/stdout.txt.expect | |
parent | bd11b24234d7d43dfe05a81c520aa01ffad06e42 (diff) | |
download | nnfw-d91a039e0eda6fd70dcd22672b8ce1817c1ca50e.tar.gz nnfw-d91a039e0eda6fd70dcd22672b8ce1817c1ca50e.tar.bz2 nnfw-d91a039e0eda6fd70dcd22672b8ce1817c1ca50e.zip |
catch up to tizen_5.5 and remove unness dir
- update to tizen_5.5
- remove dirs
Diffstat (limited to 'tests/nnapi/nnapi_test_generator/android-q-beta/tests/P_vts_naming/stdout.txt.expect')
-rw-r--r-- | tests/nnapi/nnapi_test_generator/android-q-beta/tests/P_vts_naming/stdout.txt.expect | 3548 |
1 files changed, 3548 insertions, 0 deletions
diff --git a/tests/nnapi/nnapi_test_generator/android-q-beta/tests/P_vts_naming/stdout.txt.expect b/tests/nnapi/nnapi_test_generator/android-q-beta/tests/P_vts_naming/stdout.txt.expect new file mode 100644 index 000000000..892700036 --- /dev/null +++ b/tests/nnapi/nnapi_test_generator/android-q-beta/tests/P_vts_naming/stdout.txt.expect @@ -0,0 +1,3548 @@ +// clang-format off +// Generated file (from: conv_float.mod.py). Do not edit +// clang-format off +// Generated file (from: conv_float.mod.py). Do not edit +// Generated from: conv_float.mod.py. +namespace conv_float { +// Generated conv_float test +#include "-" +// Generated model constructor +#include "-" +} // namespace conv_float + +// Create the model +Model createTestModel_model_name_nhwc_act_w_as_param_float() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 64}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 64, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 68, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 72, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 76, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 80, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 84, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 128, 64, 0, 0, 160, 64, 0, 0, 192, 64, 0, 0, 224, 64, 0, 0, 0, 65, 0, 0, 0, 65, 0, 0, 224, 64, 0, 0, 192, 64, 0, 0, 160, 64, 0, 0, 128, 64, 0, 0, 64, 64, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nhwc_act_w_as_param_float(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_act_w_as_param_float = { +// 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, 5.0f, 6.0f, 7.0f, 8.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {204.0f, 120.0f, 94.0f, 104.0f, 70.0f, 164.0f, 23.0f, 112.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_act_w_as_param_float) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_act_w_as_param_float, + conv_float::is_ignored_model_name_nhwc_act_w_as_param_float, + conv_float::examples_model_name_example_name_nhwc_act_w_as_param_float); +} + +// Create the model +Model createTestModel_model_name_nhwc_act_w_as_param_float_relaxed() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 64}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 64, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 68, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 72, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 76, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 80, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 84, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 128, 64, 0, 0, 160, 64, 0, 0, 192, 64, 0, 0, 224, 64, 0, 0, 0, 65, 0, 0, 0, 65, 0, 0, 224, 64, 0, 0, 192, 64, 0, 0, 160, 64, 0, 0, 128, 64, 0, 0, 64, 64, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + .relaxComputationFloat32toFloat16 = true, + }; +} + +bool is_ignored_model_name_nhwc_act_w_as_param_float_relaxed(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_act_w_as_param_float_relaxed = { +// 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, 5.0f, 6.0f, 7.0f, 8.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {204.0f, 120.0f, 94.0f, 104.0f, 70.0f, 164.0f, 23.0f, 112.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_act_w_as_param_float_relaxed) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_act_w_as_param_float_relaxed, + conv_float::is_ignored_model_name_nhwc_act_w_as_param_float_relaxed, + conv_float::examples_model_name_example_name_nhwc_act_w_as_param_float_relaxed); +} + +// Create the model +Model createTestModel_model_name_nhwc_act_w_as_param_quantized() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.5f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.25f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 16}, + }, + { + .type = OperandType::TENSOR_INT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.125f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 24, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 28, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 32, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 36, .length = 4}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 2.0f, + .zeroPoint = 100, + .lifetime = OperandLifeTime::MODEL_OUTPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + } + }; + + const std::vector<Operation> operations = { + { + .type = OperationType::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 132, 136, 140, 144, 148, 152, 156, 160, 160, 156, 152, 148, 144, 140, 136, 132, 192, 249, 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nhwc_act_w_as_param_quantized(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_act_w_as_param_quantized = { +// 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, {130, 132, 134, 136, 138, 140, 142, 144}}} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {{0, {202, 160, 147, 152, 135, 182, 112, 156}}} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_act_w_as_param_quantized) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_act_w_as_param_quantized, + conv_float::is_ignored_model_name_nhwc_act_w_as_param_quantized, + conv_float::examples_model_name_example_name_nhwc_act_w_as_param_quantized); +} + +// Create the model +Model createTestModel_model_name_nhwc_act_w_as_input_float() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nhwc_act_w_as_input_float(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_act_w_as_input_float = { +// 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, 5.0f, 6.0f, 7.0f, 8.0f}}, {1, {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 8.0f, 7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {204.0f, 120.0f, 94.0f, 104.0f, 70.0f, 164.0f, 23.0f, 112.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_act_w_as_input_float) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_act_w_as_input_float, + conv_float::is_ignored_model_name_nhwc_act_w_as_input_float, + conv_float::examples_model_name_example_name_nhwc_act_w_as_input_float); +} + +// Create the model +Model createTestModel_model_name_nhwc_act_w_as_input_float_relaxed() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + .relaxComputationFloat32toFloat16 = true, + }; +} + +bool is_ignored_model_name_nhwc_act_w_as_input_float_relaxed(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_act_w_as_input_float_relaxed = { +// 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, 5.0f, 6.0f, 7.0f, 8.0f}}, {1, {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 8.0f, 7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {204.0f, 120.0f, 94.0f, 104.0f, 70.0f, 164.0f, 23.0f, 112.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_act_w_as_input_float_relaxed) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_act_w_as_input_float_relaxed, + conv_float::is_ignored_model_name_nhwc_act_w_as_input_float_relaxed, + conv_float::examples_model_name_example_name_nhwc_act_w_as_input_float_relaxed); +} + +// Create the model +Model createTestModel_model_name_nhwc_act_w_as_input_quantized() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.5f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.25f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_INT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.125f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 2.0f, + .zeroPoint = 100, + .lifetime = OperandLifeTime::MODEL_OUTPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + } + }; + + const std::vector<Operation> operations = { + { + .type = OperationType::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 192, 249, 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nhwc_act_w_as_input_quantized(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_act_w_as_input_quantized = { +// 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, {130, 132, 134, 136, 138, 140, 142, 144}}, {1, {132, 136, 140, 144, 148, 152, 156, 160, 160, 156, 152, 148, 144, 140, 136, 132}}} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {{0, {202, 160, 147, 152, 135, 182, 112, 156}}} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_act_w_as_input_quantized) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_act_w_as_input_quantized, + conv_float::is_ignored_model_name_nhwc_act_w_as_input_quantized, + conv_float::examples_model_name_example_name_nhwc_act_w_as_input_quantized); +} + +// Create the model +Model createTestModel_model_name_nhwc_relu6_w_as_param_float() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 64}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 64, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 68, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 72, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 76, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 80, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 84, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 128, 64, 0, 0, 160, 64, 0, 0, 192, 64, 0, 0, 224, 64, 0, 0, 0, 65, 0, 0, 0, 65, 0, 0, 224, 64, 0, 0, 192, 64, 0, 0, 160, 64, 0, 0, 128, 64, 0, 0, 64, 64, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nhwc_relu6_w_as_param_float(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_relu6_w_as_param_float = { +// 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, 5.0f, 6.0f, 7.0f, 8.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_relu6_w_as_param_float) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_relu6_w_as_param_float, + conv_float::is_ignored_model_name_nhwc_relu6_w_as_param_float, + conv_float::examples_model_name_example_name_nhwc_relu6_w_as_param_float); +} + +// Create the model +Model createTestModel_model_name_nhwc_relu6_w_as_param_float_relaxed() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 64}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 64, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 68, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 72, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 76, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 80, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 84, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 128, 64, 0, 0, 160, 64, 0, 0, 192, 64, 0, 0, 224, 64, 0, 0, 0, 65, 0, 0, 0, 65, 0, 0, 224, 64, 0, 0, 192, 64, 0, 0, 160, 64, 0, 0, 128, 64, 0, 0, 64, 64, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + .relaxComputationFloat32toFloat16 = true, + }; +} + +bool is_ignored_model_name_nhwc_relu6_w_as_param_float_relaxed(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_relu6_w_as_param_float_relaxed = { +// 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, 5.0f, 6.0f, 7.0f, 8.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_relu6_w_as_param_float_relaxed) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_relu6_w_as_param_float_relaxed, + conv_float::is_ignored_model_name_nhwc_relu6_w_as_param_float_relaxed, + conv_float::examples_model_name_example_name_nhwc_relu6_w_as_param_float_relaxed); +} + +// Create the model +Model createTestModel_model_name_nhwc_relu6_w_as_param_quantized() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.5f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.25f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 16}, + }, + { + .type = OperandType::TENSOR_INT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.125f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 24, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 28, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 32, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 36, .length = 4}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 2.0f, + .zeroPoint = 100, + .lifetime = OperandLifeTime::MODEL_OUTPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + } + }; + + const std::vector<Operation> operations = { + { + .type = OperationType::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 132, 136, 140, 144, 148, 152, 156, 160, 160, 156, 152, 148, 144, 140, 136, 132, 192, 249, 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nhwc_relu6_w_as_param_quantized(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_relu6_w_as_param_quantized = { +// 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, {130, 132, 134, 136, 138, 140, 142, 144}}} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {{0, {103, 103, 103, 103, 103, 103, 103, 103}}} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_relu6_w_as_param_quantized) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_relu6_w_as_param_quantized, + conv_float::is_ignored_model_name_nhwc_relu6_w_as_param_quantized, + conv_float::examples_model_name_example_name_nhwc_relu6_w_as_param_quantized); +} + +// Create the model +Model createTestModel_model_name_nhwc_relu6_w_as_input_float() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nhwc_relu6_w_as_input_float(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_relu6_w_as_input_float = { +// 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, 5.0f, 6.0f, 7.0f, 8.0f}}, {1, {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 8.0f, 7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_relu6_w_as_input_float) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_relu6_w_as_input_float, + conv_float::is_ignored_model_name_nhwc_relu6_w_as_input_float, + conv_float::examples_model_name_example_name_nhwc_relu6_w_as_input_float); +} + +// Create the model +Model createTestModel_model_name_nhwc_relu6_w_as_input_float_relaxed() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + .relaxComputationFloat32toFloat16 = true, + }; +} + +bool is_ignored_model_name_nhwc_relu6_w_as_input_float_relaxed(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_relu6_w_as_input_float_relaxed = { +// 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, 5.0f, 6.0f, 7.0f, 8.0f}}, {1, {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 8.0f, 7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_relu6_w_as_input_float_relaxed) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_relu6_w_as_input_float_relaxed, + conv_float::is_ignored_model_name_nhwc_relu6_w_as_input_float_relaxed, + conv_float::examples_model_name_example_name_nhwc_relu6_w_as_input_float_relaxed); +} + +// Create the model +Model createTestModel_model_name_nhwc_relu6_w_as_input_quantized() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.5f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.25f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_INT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.125f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 2.0f, + .zeroPoint = 100, + .lifetime = OperandLifeTime::MODEL_OUTPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + } + }; + + const std::vector<Operation> operations = { + { + .type = OperationType::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 192, 249, 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nhwc_relu6_w_as_input_quantized(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nhwc_relu6_w_as_input_quantized = { +// 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, {130, 132, 134, 136, 138, 140, 142, 144}}, {1, {132, 136, 140, 144, 148, 152, 156, 160, 160, 156, 152, 148, 144, 140, 136, 132}}} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {{0, {103, 103, 103, 103, 103, 103, 103, 103}}} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nhwc_relu6_w_as_input_quantized) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nhwc_relu6_w_as_input_quantized, + conv_float::is_ignored_model_name_nhwc_relu6_w_as_input_quantized, + conv_float::examples_model_name_example_name_nhwc_relu6_w_as_input_quantized); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_act_w_as_param_float() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 64}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 64, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 68, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 72, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 76, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 80, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 84, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 128, 63, 0, 0, 64, 64, 0, 0, 160, 64, 0, 0, 224, 64, 0, 0, 0, 64, 0, 0, 128, 64, 0, 0, 192, 64, 0, 0, 0, 65, 0, 0, 0, 65, 0, 0, 192, 64, 0, 0, 128, 64, 0, 0, 0, 64, 0, 0, 224, 64, 0, 0, 160, 64, 0, 0, 64, 64, 0, 0, 128, 63, 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nchw_layout_act_w_as_param_float(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_act_w_as_param_float = { +// Begin of an example +{ +//Input(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {204.0f, 94.0f, 70.0f, 23.0f, 120.0f, 104.0f, 164.0f, 112.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_act_w_as_param_float) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_act_w_as_param_float, + conv_float::is_ignored_model_name_nchw_layout_act_w_as_param_float, + conv_float::examples_model_name_example_name_nchw_layout_act_w_as_param_float); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_act_w_as_param_float_relaxed() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 64}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 64, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 68, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 72, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 76, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 80, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 84, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 128, 63, 0, 0, 64, 64, 0, 0, 160, 64, 0, 0, 224, 64, 0, 0, 0, 64, 0, 0, 128, 64, 0, 0, 192, 64, 0, 0, 0, 65, 0, 0, 0, 65, 0, 0, 192, 64, 0, 0, 128, 64, 0, 0, 0, 64, 0, 0, 224, 64, 0, 0, 160, 64, 0, 0, 64, 64, 0, 0, 128, 63, 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + .relaxComputationFloat32toFloat16 = true, + }; +} + +bool is_ignored_model_name_nchw_layout_act_w_as_param_float_relaxed(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_act_w_as_param_float_relaxed = { +// Begin of an example +{ +//Input(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {204.0f, 94.0f, 70.0f, 23.0f, 120.0f, 104.0f, 164.0f, 112.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_act_w_as_param_float_relaxed) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_act_w_as_param_float_relaxed, + conv_float::is_ignored_model_name_nchw_layout_act_w_as_param_float_relaxed, + conv_float::examples_model_name_example_name_nchw_layout_act_w_as_param_float_relaxed); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_act_w_as_param_quantized() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.5f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.25f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 16}, + }, + { + .type = OperandType::TENSOR_INT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.125f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 24, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 28, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 32, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 36, .length = 4}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 2.0f, + .zeroPoint = 100, + .lifetime = OperandLifeTime::MODEL_OUTPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + } + }; + + const std::vector<Operation> operations = { + { + .type = OperationType::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 132, 140, 148, 156, 136, 144, 152, 160, 160, 152, 144, 136, 156, 148, 140, 132, 192, 249, 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nchw_layout_act_w_as_param_quantized(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_act_w_as_param_quantized = { +// 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, {130, 134, 138, 142, 132, 136, 140, 144}}} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {{0, {202, 147, 135, 112, 160, 152, 182, 156}}} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_act_w_as_param_quantized) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_act_w_as_param_quantized, + conv_float::is_ignored_model_name_nchw_layout_act_w_as_param_quantized, + conv_float::examples_model_name_example_name_nchw_layout_act_w_as_param_quantized); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_act_w_as_input_float() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nchw_layout_act_w_as_input_float(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_act_w_as_input_float = { +// Begin of an example +{ +//Input(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f}}, {1, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f, 8.0f, 6.0f, 4.0f, 2.0f, 7.0f, 5.0f, 3.0f, 1.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {204.0f, 94.0f, 70.0f, 23.0f, 120.0f, 104.0f, 164.0f, 112.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_act_w_as_input_float) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_act_w_as_input_float, + conv_float::is_ignored_model_name_nchw_layout_act_w_as_input_float, + conv_float::examples_model_name_example_name_nchw_layout_act_w_as_input_float); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_act_w_as_input_float_relaxed() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + .relaxComputationFloat32toFloat16 = true, + }; +} + +bool is_ignored_model_name_nchw_layout_act_w_as_input_float_relaxed(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_act_w_as_input_float_relaxed = { +// Begin of an example +{ +//Input(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f}}, {1, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f, 8.0f, 6.0f, 4.0f, 2.0f, 7.0f, 5.0f, 3.0f, 1.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {204.0f, 94.0f, 70.0f, 23.0f, 120.0f, 104.0f, 164.0f, 112.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_act_w_as_input_float_relaxed) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_act_w_as_input_float_relaxed, + conv_float::is_ignored_model_name_nchw_layout_act_w_as_input_float_relaxed, + conv_float::examples_model_name_example_name_nchw_layout_act_w_as_input_float_relaxed); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_act_w_as_input_quantized() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.5f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.25f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_INT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.125f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 2.0f, + .zeroPoint = 100, + .lifetime = OperandLifeTime::MODEL_OUTPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + } + }; + + const std::vector<Operation> operations = { + { + .type = OperationType::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 192, 249, 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nchw_layout_act_w_as_input_quantized(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_act_w_as_input_quantized = { +// 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, {130, 134, 138, 142, 132, 136, 140, 144}}, {1, {132, 140, 148, 156, 136, 144, 152, 160, 160, 152, 144, 136, 156, 148, 140, 132}}} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {{0, {202, 147, 135, 112, 160, 152, 182, 156}}} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_act_w_as_input_quantized) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_act_w_as_input_quantized, + conv_float::is_ignored_model_name_nchw_layout_act_w_as_input_quantized, + conv_float::examples_model_name_example_name_nchw_layout_act_w_as_input_quantized); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_relu6_w_as_param_float() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 64}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 64, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 68, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 72, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 76, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 80, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 84, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 128, 63, 0, 0, 64, 64, 0, 0, 160, 64, 0, 0, 224, 64, 0, 0, 0, 64, 0, 0, 128, 64, 0, 0, 192, 64, 0, 0, 0, 65, 0, 0, 0, 65, 0, 0, 192, 64, 0, 0, 128, 64, 0, 0, 0, 64, 0, 0, 224, 64, 0, 0, 160, 64, 0, 0, 64, 64, 0, 0, 128, 63, 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nchw_layout_relu6_w_as_param_float(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_relu6_w_as_param_float = { +// Begin of an example +{ +//Input(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_relu6_w_as_param_float) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_relu6_w_as_param_float, + conv_float::is_ignored_model_name_nchw_layout_relu6_w_as_param_float, + conv_float::examples_model_name_example_name_nchw_layout_relu6_w_as_param_float); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_relu6_w_as_param_float_relaxed() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 64}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 64, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 68, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 72, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 76, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 80, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 84, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 128, 63, 0, 0, 64, 64, 0, 0, 160, 64, 0, 0, 224, 64, 0, 0, 0, 64, 0, 0, 128, 64, 0, 0, 192, 64, 0, 0, 0, 65, 0, 0, 0, 65, 0, 0, 192, 64, 0, 0, 128, 64, 0, 0, 0, 64, 0, 0, 224, 64, 0, 0, 160, 64, 0, 0, 64, 64, 0, 0, 128, 63, 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + .relaxComputationFloat32toFloat16 = true, + }; +} + +bool is_ignored_model_name_nchw_layout_relu6_w_as_param_float_relaxed(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_relu6_w_as_param_float_relaxed = { +// Begin of an example +{ +//Input(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_relu6_w_as_param_float_relaxed) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_relu6_w_as_param_float_relaxed, + conv_float::is_ignored_model_name_nchw_layout_relu6_w_as_param_float_relaxed, + conv_float::examples_model_name_example_name_nchw_layout_relu6_w_as_param_float_relaxed); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_relu6_w_as_param_quantized() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.5f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.25f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 16}, + }, + { + .type = OperandType::TENSOR_INT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.125f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 24, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 28, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 32, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 36, .length = 4}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 2.0f, + .zeroPoint = 100, + .lifetime = OperandLifeTime::MODEL_OUTPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + } + }; + + const std::vector<Operation> operations = { + { + .type = OperationType::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 132, 140, 148, 156, 136, 144, 152, 160, 160, 152, 144, 136, 156, 148, 140, 132, 192, 249, 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nchw_layout_relu6_w_as_param_quantized(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_relu6_w_as_param_quantized = { +// 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, {130, 134, 138, 142, 132, 136, 140, 144}}} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {{0, {103, 103, 103, 103, 103, 103, 103, 103}}} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_relu6_w_as_param_quantized) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_relu6_w_as_param_quantized, + conv_float::is_ignored_model_name_nchw_layout_relu6_w_as_param_quantized, + conv_float::examples_model_name_example_name_nchw_layout_relu6_w_as_param_quantized); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_relu6_w_as_input_float() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nchw_layout_relu6_w_as_input_float(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_relu6_w_as_input_float = { +// Begin of an example +{ +//Input(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f}}, {1, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f, 8.0f, 6.0f, 4.0f, 2.0f, 7.0f, 5.0f, 3.0f, 1.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_relu6_w_as_input_float) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_relu6_w_as_input_float, + conv_float::is_ignored_model_name_nchw_layout_relu6_w_as_input_float, + conv_float::examples_model_name_example_name_nchw_layout_relu6_w_as_input_float); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_relu6_w_as_input_float_relaxed() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_FLOAT32, + .dimensions = {1, 2, 2, 2}, + .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::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 0, 0, 72, 195, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + .relaxComputationFloat32toFloat16 = true, + }; +} + +bool is_ignored_model_name_nchw_layout_relu6_w_as_input_float_relaxed(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_relu6_w_as_input_float_relaxed = { +// Begin of an example +{ +//Input(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f}}, {1, {1.0f, 3.0f, 5.0f, 7.0f, 2.0f, 4.0f, 6.0f, 8.0f, 8.0f, 6.0f, 4.0f, 2.0f, 7.0f, 5.0f, 3.0f, 1.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {{0, {6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f}}}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_relu6_w_as_input_float_relaxed) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_relu6_w_as_input_float_relaxed, + conv_float::is_ignored_model_name_nchw_layout_relu6_w_as_input_float_relaxed, + conv_float::examples_model_name_example_name_nchw_layout_relu6_w_as_input_float_relaxed); +} + +// Create the model +Model createTestModel_model_name_nchw_layout_relu6_w_as_input_quantized() { + const std::vector<Operand> operands = { + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 1, + .scale = 0.5f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {2, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 0.25f, + .zeroPoint = 128, + .lifetime = OperandLifeTime::MODEL_INPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + }, + { + .type = OperandType::TENSOR_INT32, + .dimensions = {1}, + .numberOfConsumers = 1, + .scale = 0.125f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 0, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 4, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 8, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 12, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 16, .length = 4}, + }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .lifetime = OperandLifeTime::CONSTANT_COPY, + .location = {.poolIndex = 0, .offset = 20, .length = 4}, + }, + { + .type = OperandType::TENSOR_QUANT8_ASYMM, + .dimensions = {1, 2, 2, 2}, + .numberOfConsumers = 0, + .scale = 2.0f, + .zeroPoint = 100, + .lifetime = OperandLifeTime::MODEL_OUTPUT, + .location = {.poolIndex = 0, .offset = 0, .length = 0}, + } + }; + + const std::vector<Operation> operations = { + { + .type = OperationType::CONV_2D, + .inputs = {0, 1, 2, 3, 4, 5, 6, 7}, + .outputs = {8}, + } + }; + + const std::vector<uint32_t> inputIndexes = {0, 1}; + const std::vector<uint32_t> outputIndexes = {8}; + std::vector<uint8_t> operandValues = { + 192, 249, 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0 + }; + const std::vector<hidl_memory> pools = {}; + + return { + .operands = operands, + .operations = operations, + .inputIndexes = inputIndexes, + .outputIndexes = outputIndexes, + .operandValues = operandValues, + .pools = pools, + }; +} + +bool is_ignored_model_name_nchw_layout_relu6_w_as_input_quantized(int i) { + static std::set<int> ignore = {}; + return ignore.find(i) != ignore.end(); +} + +std::vector<MixedTypedExample> examples_model_name_example_name_nchw_layout_relu6_w_as_input_quantized = { +// 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, {130, 134, 138, 142, 132, 136, 140, 144}}, {1, {132, 140, 148, 156, 136, 144, 152, 160, 160, 152, 144, 136, 156, 148, 140, 132}}} +}, +//Output(s) +{ // See tools/test_generator/include/TestHarness.h:MixedTyped + // int -> FLOAT32 map + {}, + // int -> INT32 map + {}, + // int -> QUANT8_ASYMM map + {{0, {103, 103, 103, 103, 103, 103, 103, 103}}} +} +}, // End of an example +}; + +TEST_F(NeuralnetworksHidlTest, conv_float_model_name_example_name_nchw_layout_relu6_w_as_input_quantized) { + generated_tests::Execute(device, + conv_float::createTestModel_model_name_nchw_layout_relu6_w_as_input_quantized, + conv_float::is_ignored_model_name_nchw_layout_relu6_w_as_input_quantized, + conv_float::examples_model_name_example_name_nchw_layout_relu6_w_as_input_quantized); +} + |