| // Generated from conv2d_per_channel.mod.py |
| // DO NOT EDIT |
| // clang-format off |
| #include "GeneratedTests.h" |
| |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 3}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9}, |
| .outputs = {10}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0}; |
| const std::vector<uint32_t> outputIndexes = {10}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9}, |
| .outputs = {10}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0}; |
| const std::vector<uint32_t> outputIndexes = {10}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_all_inputs_as_internal() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 3}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 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 = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 47, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {11, 12, 13}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, |
| .outputs = {10}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {11}; |
| const std::vector<uint32_t> outputIndexes = {10}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 128, 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_all_inputs_as_internal(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_all_inputs_as_internal_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 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 = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 47, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {11, 12, 13}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, |
| .outputs = {10}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {11}; |
| const std::vector<uint32_t> outputIndexes = {10}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 128, 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_all_inputs_as_internal_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_all_tensors_as_inputs() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 3}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9}, |
| .outputs = {10}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0, 1, 2}; |
| const std::vector<uint32_t> outputIndexes = {10}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_all_tensors_as_inputs(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_all_tensors_as_inputs_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9}, |
| .outputs = {10}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0, 1, 2}; |
| const std::vector<uint32_t> outputIndexes = {10}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_all_tensors_as_inputs_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_all_tensors_as_inputs_all_inputs_as_internal() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 3}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 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 = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 28, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 29, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {11, 12, 13}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, |
| .outputs = {10}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {1, 2, 11}; |
| const std::vector<uint32_t> outputIndexes = {10}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 128, 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_all_tensors_as_inputs_all_inputs_as_internal(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_all_tensors_as_inputs_all_inputs_as_internal_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 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 = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 28, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 29, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {11, 12, 13}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, |
| .outputs = {10}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {1, 2, 11}; |
| const std::vector<uint32_t> outputIndexes = {10}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 128, 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_all_tensors_as_inputs_all_inputs_as_internal_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nhwc() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 3}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 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_layouts_nhwc(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nhwc_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 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_layouts_nhwc_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nhwc_all_inputs_as_internal() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 3}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 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 = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 47, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 48, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {12, 13, 14}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {12}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 128, 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_layouts_nhwc_all_inputs_as_internal(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nhwc_all_inputs_as_internal_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 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 = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 47, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 48, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {12, 13, 14}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {12}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 128, 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_layouts_nhwc_all_inputs_as_internal_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nhwc_all_tensors_as_inputs() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 28, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 3}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0, 1, 2}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 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_layouts_nhwc_all_tensors_as_inputs(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nhwc_all_tensors_as_inputs_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 28, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0, 1, 2}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 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_layouts_nhwc_all_tensors_as_inputs_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nhwc_all_tensors_as_inputs_all_inputs_as_internal() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 28, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 3}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 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 = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 29, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {12, 13, 14}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {1, 2, 12}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 128, 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_layouts_nhwc_all_tensors_as_inputs_all_inputs_as_internal(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nhwc_all_tensors_as_inputs_all_inputs_as_internal_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 28, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 1, 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 = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 29, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {12, 13, 14}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {1, 2, 12}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 128, 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_layouts_nhwc_all_tensors_as_inputs_all_inputs_as_internal_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nchw() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 3, 1}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 |
| }; |
| const std::vector<hidl_memory> pools = {}; |
| |
| return { |
| .operands = operands, |
| .operations = operations, |
| .inputIndexes = inputIndexes, |
| .outputIndexes = outputIndexes, |
| .operandValues = operandValues, |
| .pools = pools, |
| }; |
| } |
| |
| bool is_ignored_layouts_nchw(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nchw_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 |
| }; |
| const std::vector<hidl_memory> pools = {}; |
| |
| return { |
| .operands = operands, |
| .operations = operations, |
| .inputIndexes = inputIndexes, |
| .outputIndexes = outputIndexes, |
| .operandValues = operandValues, |
| .pools = pools, |
| }; |
| } |
| |
| bool is_ignored_layouts_nchw_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nchw_all_inputs_as_internal() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 3, 1}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 47, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 48, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {12, 13, 14}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {12}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 128, 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_layouts_nchw_all_inputs_as_internal(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nchw_all_inputs_as_internal_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 6}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 6, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 47, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 48, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {12, 13, 14}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {12}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 128, 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_layouts_nchw_all_inputs_as_internal_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nchw_all_tensors_as_inputs() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 28, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 3, 1}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0, 1, 2}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 |
| }; |
| const std::vector<hidl_memory> pools = {}; |
| |
| return { |
| .operands = operands, |
| .operations = operations, |
| .inputIndexes = inputIndexes, |
| .outputIndexes = outputIndexes, |
| .operandValues = operandValues, |
| .pools = pools, |
| }; |
| } |
| |
| bool is_ignored_layouts_nchw_all_tensors_as_inputs(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nchw_all_tensors_as_inputs_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 28, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .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, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {0, 1, 2}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 |
| }; |
| const std::vector<hidl_memory> pools = {}; |
| |
| return { |
| .operands = operands, |
| .operations = operations, |
| .inputIndexes = inputIndexes, |
| .outputIndexes = outputIndexes, |
| .operandValues = operandValues, |
| .pools = pools, |
| }; |
| } |
| |
| bool is_ignored_layouts_nchw_all_tensors_as_inputs_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nchw_all_tensors_as_inputs_all_inputs_as_internal() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 28, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 3, 3, 1}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 29, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {12, 13, 14}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {1, 2, 12}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 128, 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_layouts_nchw_all_tensors_as_inputs_all_inputs_as_internal(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_layouts_nchw_all_tensors_as_inputs_all_inputs_as_internal_dynamic_output_shape() { |
| Operand::ExtraParams extraParams1; |
| extraParams1.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| .extraParams = std::move(extraParams1), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 4}, |
| }, |
| { |
| .type = OperandType::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::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 24, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 28, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 3, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 29, .length = 1}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::ADD, |
| .inputs = {12, 13, 14}, |
| .outputs = {0}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, |
| .outputs = {11}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {1, 2, 12}; |
| const std::vector<uint32_t> outputIndexes = {11}; |
| std::vector<uint8_t> operandValues = { |
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 128, 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_layouts_nchw_all_tensors_as_inputs_all_inputs_as_internal_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_zero_sized_nhwc() { |
| Operand::ExtraParams extraParams22; |
| extraParams22.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.1f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 2}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT16_ASYMM, |
| .dimensions = {1, 8}, |
| .numberOfConsumers = 1, |
| .scale = 0.125f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 2, .length = 16}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0}, |
| .numberOfConsumers = 0, |
| .scale = 0.1f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT16_ASYMM, |
| .dimensions = {0, 4}, |
| .numberOfConsumers = 1, |
| .scale = 0.125f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {0}, |
| .numberOfConsumers = 0, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {0}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 50, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 54, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 58, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 62, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 66, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 2, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 70, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 2, 2, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 71, .length = 6}, |
| .extraParams = std::move(extraParams22), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 77, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 89, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 93, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 97, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 101, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 105, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 109, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 113, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 2, 2, 3}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::BOX_WITH_NMS_LIMIT, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8}, |
| .outputs = {9, 10, 11, 12}, |
| }, |
| { |
| .type = OperationType::ROI_ALIGN, |
| .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20}, |
| .outputs = {21}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 20}, |
| .outputs = {31}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {13}; |
| const std::vector<uint32_t> outputIndexes = {9, 11, 31}; |
| std::vector<uint8_t> operandValues = { |
| 137, 129, 1, 0, 1, 0, 10, 0, 10, 0, 0, 0, 0, 0, 10, 0, 10, 0, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_zero_sized_nhwc(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_zero_sized_nhwc_dynamic_output_shape() { |
| Operand::ExtraParams extraParams22; |
| extraParams22.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.1f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 2}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT16_ASYMM, |
| .dimensions = {1, 8}, |
| .numberOfConsumers = 1, |
| .scale = 0.125f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 2, .length = 16}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0}, |
| .numberOfConsumers = 0, |
| .scale = 0.1f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT16_ASYMM, |
| .dimensions = {0, 4}, |
| .numberOfConsumers = 1, |
| .scale = 0.125f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {0}, |
| .numberOfConsumers = 0, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {0}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 50, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 54, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 58, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 62, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 66, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 2, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 70, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 2, 2, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 71, .length = 6}, |
| .extraParams = std::move(extraParams22), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 77, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 89, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 93, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 97, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 101, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 105, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 109, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 113, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::BOX_WITH_NMS_LIMIT, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8}, |
| .outputs = {9, 10, 11, 12}, |
| }, |
| { |
| .type = OperationType::ROI_ALIGN, |
| .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20}, |
| .outputs = {21}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 20}, |
| .outputs = {31}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {13}; |
| const std::vector<uint32_t> outputIndexes = {9, 11, 31}; |
| std::vector<uint8_t> operandValues = { |
| 137, 129, 1, 0, 1, 0, 10, 0, 10, 0, 0, 0, 0, 0, 10, 0, 10, 0, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_zero_sized_nhwc_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_zero_sized_nchw() { |
| Operand::ExtraParams extraParams22; |
| extraParams22.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.1f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 2}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT16_ASYMM, |
| .dimensions = {1, 8}, |
| .numberOfConsumers = 1, |
| .scale = 0.125f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 2, .length = 16}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0}, |
| .numberOfConsumers = 0, |
| .scale = 0.1f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT16_ASYMM, |
| .dimensions = {0, 4}, |
| .numberOfConsumers = 1, |
| .scale = 0.125f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {0}, |
| .numberOfConsumers = 0, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {0}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 1, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 50, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 54, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 58, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 62, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 66, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 2, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 70, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 2, 2, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 71, .length = 6}, |
| .extraParams = std::move(extraParams22), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 77, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 89, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 93, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 97, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 101, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 105, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 109, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 113, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 3, 2, 2}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::BOX_WITH_NMS_LIMIT, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8}, |
| .outputs = {9, 10, 11, 12}, |
| }, |
| { |
| .type = OperationType::ROI_ALIGN, |
| .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20}, |
| .outputs = {21}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 20}, |
| .outputs = {31}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {13}; |
| const std::vector<uint32_t> outputIndexes = {9, 11, 31}; |
| std::vector<uint8_t> operandValues = { |
| 137, 129, 1, 0, 1, 0, 10, 0, 10, 0, 0, 0, 0, 0, 10, 0, 10, 0, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1, 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_zero_sized_nchw(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |
| namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel { |
| |
| Model createTestModel_zero_sized_nchw_dynamic_output_shape() { |
| Operand::ExtraParams extraParams22; |
| extraParams22.channelQuant(SymmPerChannelQuantParams{.scales={0.5f, 0.75f, 1.0f}, .channelDim=0}); |
| const std::vector<Operand> operands = { |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.1f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 0, .length = 2}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT16_ASYMM, |
| .dimensions = {1, 8}, |
| .numberOfConsumers = 1, |
| .scale = 0.125f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 2, .length = 16}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {1}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 18, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 22, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 26, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 30, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 34, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 38, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 42, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0}, |
| .numberOfConsumers = 0, |
| .scale = 0.1f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT16_ASYMM, |
| .dimensions = {0, 4}, |
| .numberOfConsumers = 1, |
| .scale = 0.125f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {0}, |
| .numberOfConsumers = 0, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {0}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {1, 2, 1, 1}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_INPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 46, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 50, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 54, .length = 4}, |
| }, |
| { |
| .type = OperandType::FLOAT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 58, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 62, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 66, .length = 4}, |
| }, |
| { |
| .type = OperandType::BOOL, |
| .dimensions = {}, |
| .numberOfConsumers = 2, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 70, .length = 1}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 2, 2, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.5f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::TEMPORARY_VARIABLE, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| .dimensions = {3, 1, 1, 2}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 71, .length = 6}, |
| .extraParams = std::move(extraParams22), |
| }, |
| { |
| .type = OperandType::TENSOR_INT32, |
| .dimensions = {3}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 77, .length = 12}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 89, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 93, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 97, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 101, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 105, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 109, .length = 4}, |
| }, |
| { |
| .type = OperandType::INT32, |
| .dimensions = {}, |
| .numberOfConsumers = 1, |
| .scale = 0.0f, |
| .zeroPoint = 0, |
| .lifetime = OperandLifeTime::CONSTANT_COPY, |
| .location = {.poolIndex = 0, .offset = 113, .length = 4}, |
| }, |
| { |
| .type = OperandType::TENSOR_QUANT8_ASYMM, |
| .dimensions = {0, 0, 0, 0}, |
| .numberOfConsumers = 0, |
| .scale = 1.0f, |
| .zeroPoint = 128, |
| .lifetime = OperandLifeTime::MODEL_OUTPUT, |
| .location = {.poolIndex = 0, .offset = 0, .length = 0}, |
| } |
| }; |
| |
| const std::vector<Operation> operations = { |
| { |
| .type = OperationType::BOX_WITH_NMS_LIMIT, |
| .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8}, |
| .outputs = {9, 10, 11, 12}, |
| }, |
| { |
| .type = OperationType::ROI_ALIGN, |
| .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20}, |
| .outputs = {21}, |
| }, |
| { |
| .type = OperationType::CONV_2D, |
| .inputs = {21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 20}, |
| .outputs = {31}, |
| } |
| }; |
| |
| const std::vector<uint32_t> inputIndexes = {13}; |
| const std::vector<uint32_t> outputIndexes = {9, 11, 31}; |
| std::vector<uint8_t> operandValues = { |
| 137, 129, 1, 0, 1, 0, 10, 0, 10, 0, 0, 0, 0, 0, 10, 0, 10, 0, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1, 1, 2, 1, 2, 1, 2, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_zero_sized_nchw_dynamic_output_shape(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| } // namespace android::hardware::neuralnetworks::V1_2::generated_tests::conv2d_per_channel |