Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9641e72b authored by Xusong Wang's avatar Xusong Wang Committed by android-build-merger
Browse files

Modify 1.2 VTS tests to consume test struct directly. am: 6d0270b0 am: dbf94aa2

am: 1a00a6e8

Change-Id: Ie58cced103a49bfb10b9508284824314c98b2c41
parents 2cebd0c9 1a00a6e8
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <android/hidl/memory/1.0/IMemory.h>
#include <hidlmemory/mapping.h>

#include <algorithm>
#include <vector>

namespace android {
@@ -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 = {}};
    }

+2 −3
Original line number Diff line number Diff line
@@ -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"],
}
@@ -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",
    ],
}
+137 −208

File changed.

Preview size limit exceeded, changes collapsed.

+262 −289

File changed.

Preview size limit exceeded, changes collapsed.

+4 −7

File changed.

Preview size limit exceeded, changes collapsed.

Loading