Loading neuralnetworks/1.0/vts/functional/Utils.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <android/hidl/memory/1.0/IMemory.h> #include <hidlmemory/mapping.h> #include <algorithm> #include <vector> namespace android { Loading Loading @@ -63,11 +64,19 @@ Request createRequest(const TestModel& testModel) { size_t outputSize = 0; for (uint32_t i = 0; i < testModel.outputIndexes.size(); i++) { const auto& op = testModel.operands[testModel.outputIndexes[i]]; size_t dataSize = op.data.size(); // In the case of zero-sized output, we should at least provide a one-byte buffer. // This is because zero-sized tensors are only supported internally to the driver, or // reported in output shapes. It is illegal for the client to pre-specify a zero-sized // tensor as model output. Otherwise, we will have two semantic conflicts: // - "Zero dimension" conflicts with "unspecified dimension". // - "Omitted operand buffer" conflicts with "zero-sized operand buffer". size_t bufferSize = std::max<size_t>(op.data.size(), 1); DataLocation loc = {.poolIndex = kOutputPoolIndex, .offset = static_cast<uint32_t>(outputSize), .length = static_cast<uint32_t>(dataSize)}; outputSize += op.data.alignedSize(); .length = static_cast<uint32_t>(bufferSize)}; outputSize += op.data.size() == 0 ? TestBuffer::kAlignment : op.data.alignedSize(); outputs[i] = {.hasNoValue = false, .location = loc, .dimensions = {}}; } Loading neuralnetworks/1.2/vts/functional/Android.bp +2 −3 Original line number Diff line number Diff line Loading @@ -37,13 +37,12 @@ cc_defaults { "android.hidl.memory@1.0", "libgmock", "libhidlmemory", "libneuralnetworks_generated_test_harness", "libneuralnetworks_utils", "VtsHalNeuralNetworksV1_0_utils", ], header_libs: [ "libneuralnetworks_headers", "libneuralnetworks_generated_test_harness_headers", "libneuralnetworks_generated_tests", ], test_suites: ["general-tests"], } Loading Loading @@ -75,8 +74,8 @@ cc_test { srcs: [ "BasicTests.cpp", ":VtsHalNeuralNetworksV1_2_all_generated_V1_2_tests", ":VtsHalNeuralNetworksV1_2_mobilenets", "CompilationCachingTests.cpp", ":VtsHalNeuralNetworksV1_2_mobilenets", // CompilationCachingTests depend on MobileNets. "ValidateBurst.cpp", ], } Loading Loading
neuralnetworks/1.0/vts/functional/Utils.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <android/hidl/memory/1.0/IMemory.h> #include <hidlmemory/mapping.h> #include <algorithm> #include <vector> namespace android { Loading Loading @@ -63,11 +64,19 @@ Request createRequest(const TestModel& testModel) { size_t outputSize = 0; for (uint32_t i = 0; i < testModel.outputIndexes.size(); i++) { const auto& op = testModel.operands[testModel.outputIndexes[i]]; size_t dataSize = op.data.size(); // In the case of zero-sized output, we should at least provide a one-byte buffer. // This is because zero-sized tensors are only supported internally to the driver, or // reported in output shapes. It is illegal for the client to pre-specify a zero-sized // tensor as model output. Otherwise, we will have two semantic conflicts: // - "Zero dimension" conflicts with "unspecified dimension". // - "Omitted operand buffer" conflicts with "zero-sized operand buffer". size_t bufferSize = std::max<size_t>(op.data.size(), 1); DataLocation loc = {.poolIndex = kOutputPoolIndex, .offset = static_cast<uint32_t>(outputSize), .length = static_cast<uint32_t>(dataSize)}; outputSize += op.data.alignedSize(); .length = static_cast<uint32_t>(bufferSize)}; outputSize += op.data.size() == 0 ? TestBuffer::kAlignment : op.data.alignedSize(); outputs[i] = {.hasNoValue = false, .location = loc, .dimensions = {}}; } Loading
neuralnetworks/1.2/vts/functional/Android.bp +2 −3 Original line number Diff line number Diff line Loading @@ -37,13 +37,12 @@ cc_defaults { "android.hidl.memory@1.0", "libgmock", "libhidlmemory", "libneuralnetworks_generated_test_harness", "libneuralnetworks_utils", "VtsHalNeuralNetworksV1_0_utils", ], header_libs: [ "libneuralnetworks_headers", "libneuralnetworks_generated_test_harness_headers", "libneuralnetworks_generated_tests", ], test_suites: ["general-tests"], } Loading Loading @@ -75,8 +74,8 @@ cc_test { srcs: [ "BasicTests.cpp", ":VtsHalNeuralNetworksV1_2_all_generated_V1_2_tests", ":VtsHalNeuralNetworksV1_2_mobilenets", "CompilationCachingTests.cpp", ":VtsHalNeuralNetworksV1_2_mobilenets", // CompilationCachingTests depend on MobileNets. "ValidateBurst.cpp", ], } Loading