From 8454fcd4dcd293f580c257f13b3dd21081e02330 Mon Sep 17 00:00:00 2001 From: David Gross Date: Fri, 25 Aug 2017 16:25:01 -0700 Subject: [PATCH] Fix test that broke when number of ADD inputs increased from 2 to 3. Test: vts: nn32, nn64 Bug: 63905942 Change-Id: Ie4b237d0c16247d7774a13384a59453da94c5d91 --- .../VtsHalNeuralnetworksV1_0TargetTest.cpp | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworksV1_0TargetTest.cpp b/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworksV1_0TargetTest.cpp index 5e6b1bd63f..930ddcaee8 100644 --- a/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworksV1_0TargetTest.cpp +++ b/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworksV1_0TargetTest.cpp @@ -89,6 +89,7 @@ Model createTestModel() { const uint32_t operand1 = 0; const uint32_t operand2 = 1; const uint32_t operand3 = 2; + const uint32_t operand4 = 3; const std::vector operands = { { @@ -111,6 +112,16 @@ Model createTestModel() { .offset = 0, .length = size}, }, + { + .type = OperandType::INT32, + .dimensions = {}, + .numberOfConsumers = 1, + .scale = 0.0f, + .zeroPoint = 0, + .location = {.poolIndex = static_cast(LocationValues::LOCATION_SAME_BLOCK), + .offset = size, + .length = sizeof(int32_t)}, + }, { .type = OperandType::TENSOR_FLOAT32, .dimensions = {1, 2, 2, 1}, @@ -125,15 +136,19 @@ Model createTestModel() { const std::vector operations = {{ .opTuple = {OperationType::ADD, OperandType::TENSOR_FLOAT32}, - .inputs = {operand1, operand2}, - .outputs = {operand3}, + .inputs = {operand1, operand2, operand3}, + .outputs = {operand4}, }}; const std::vector inputIndexes = {operand1}; - const std::vector outputIndexes = {operand3}; - const std::vector operandValues(reinterpret_cast(operand2Data.data()), - reinterpret_cast(operand2Data.data()) + - operand2Data.size() * sizeof(float)); + const std::vector outputIndexes = {operand4}; + std::vector operandValues( + reinterpret_cast(operand2Data.data()), + reinterpret_cast(operand2Data.data()) + size); + int32_t activation[1] = {0}; + operandValues.insert(operandValues.end(), reinterpret_cast(&activation[0]), + reinterpret_cast(&activation[1])); + const std::vector pools = {}; return {