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

Commit 6693e762 authored by Xusong Wang's avatar Xusong Wang Committed by android-build-merger
Browse files

Test dynamic output shape in GeneratedTests.

am: d22c5232

Change-Id: Ia9b6a77feeff6fc17ee98405aa660b20eeb2fff7
parents c8f068d3 d22c5232
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -20,7 +20,11 @@ cc_test {
    defaults: ["VtsHalNeuralNetworksTargetTestDefaults"],
    srcs: [
        "GeneratedTestsV1_0.cpp",
    ]
    ],
    cflags: [
        "-DNN_TEST_DYNAMIC_OUTPUT_SHAPE"
    ],
    test_suites: ["general-tests"],
}

// Tests for V1_1 models using the V1_2 HAL.
@@ -30,6 +34,10 @@ cc_test {
    srcs: [
        "GeneratedTestsV1_1.cpp",
    ],
    cflags: [
        "-DNN_TEST_DYNAMIC_OUTPUT_SHAPE"
    ],
    test_suites: ["general-tests"],
}

// Tests for V1_2 models.
@@ -40,5 +48,8 @@ cc_test {
        "BasicTests.cpp",
        "GeneratedTests.cpp",
    ],
    cflags: [
        "-DNN_TEST_DYNAMIC_OUTPUT_SHAPE"
    ],
    test_suites: ["general-tests"],
}
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ namespace neuralnetworks {
namespace generated_tests {
using ::test_helper::MixedTypedExample;
extern void Execute(const sp<V1_2::IDevice>&, std::function<V1_2::Model(void)>,
                    std::function<bool(int)>, const std::vector<MixedTypedExample>&);
                    std::function<bool(int)>, const std::vector<MixedTypedExample>&,
                    bool testDynamicOutputShape = false);
}  // namespace generated_tests

namespace V1_2 {
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ namespace neuralnetworks {
namespace generated_tests {
using ::test_helper::MixedTypedExample;
extern void Execute(const sp<V1_2::IDevice>&, std::function<V1_2::Model(void)>,
                    std::function<bool(int)>, const std::vector<MixedTypedExample>&);
                    std::function<bool(int)>, const std::vector<MixedTypedExample>&,
                    bool testDynamicOutputShape = false);
}  // namespace generated_tests

namespace V1_2 {
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ namespace neuralnetworks {
namespace generated_tests {
using ::test_helper::MixedTypedExample;
extern void Execute(const sp<V1_2::IDevice>&, std::function<V1_2::Model(void)>,
                    std::function<bool(int)>, const std::vector<MixedTypedExample>&);
                    std::function<bool(int)>, const std::vector<MixedTypedExample>&,
                    bool testDynamicOutputShape = false);
}  // namespace generated_tests

namespace V1_2 {
+3 −0
Original line number Diff line number Diff line
@@ -172,6 +172,9 @@ static uint32_t getInvalidRank(OperandType type) {
static void mutateOperandRankTest(const sp<IDevice>& device, const Model& model) {
    for (size_t operand = 0; operand < model.operands.size(); ++operand) {
        const uint32_t invalidRank = getInvalidRank(model.operands[operand].type);
        if (invalidRank == 0) {
            continue;
        }
        const std::string message = "mutateOperandRankTest: operand " + std::to_string(operand) +
                                    " has rank of " + std::to_string(invalidRank);
        validate(device, message, model, [operand, invalidRank](Model* model) {
Loading