diff options
author | Xusong Wang <xusongw@google.com> | 2020-05-08 16:52:16 -0700 |
---|---|---|
committer | Xusong Wang <xusongw@google.com> | 2020-05-26 15:08:12 -0700 |
commit | d454751e007aef434ae2397a727ebfb3f8904a4d (patch) | |
tree | 530707d983bf6199194f8e2b0e96e2b667806a54 /neuralnetworks | |
parent | 03859a7c36766627ae0e30674964e197def14955 (diff) | |
download | platform_hardware_interfaces-d454751e007aef434ae2397a727ebfb3f8904a4d.tar.gz platform_hardware_interfaces-d454751e007aef434ae2397a727ebfb3f8904a4d.tar.bz2 platform_hardware_interfaces-d454751e007aef434ae2397a727ebfb3f8904a4d.zip |
Add checks of output shapes when OUTPUT_INSUFFICIENT_SIZE.
Add checks that all returned output dimensions must be at
least as fully specified as the union of the information about the
corresponding operand in the model and in the request.
Bug: 154054474
Test: VTS
Change-Id: I934d084c7665160a98da9828604ce8297fef73b8
Diffstat (limited to 'neuralnetworks')
-rw-r--r-- | neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp index 4dbac1645a..914a01a5e6 100644 --- a/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp +++ b/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp @@ -568,8 +568,10 @@ void EvaluatePreparedModel(const sp<IDevice>& device, const sp<IPreparedModel>& } Request request = std::move(maybeRequest.value()); + + constexpr uint32_t kInsufficientOutputIndex = 0; if (testConfig.outputType == OutputType::INSUFFICIENT) { - makeOutputInsufficientSize(/*outputIndex=*/0, &request); + makeOutputInsufficientSize(kInsufficientOutputIndex, &request); } OptionalTimeoutDuration loopTimeoutDuration; @@ -745,7 +747,21 @@ void EvaluatePreparedModel(const sp<IDevice>& device, const sp<IPreparedModel>& } ASSERT_EQ(ErrorStatus::OUTPUT_INSUFFICIENT_SIZE, executionStatus); ASSERT_EQ(outputShapes.size(), testModel.main.outputIndexes.size()); - ASSERT_FALSE(outputShapes[0].isSufficient); + // Check that all returned output dimensions are at least as fully specified as the + // union of the information about the corresponding operand in the model and in the + // request. In this test, all model outputs have known rank with all dimensions + // unspecified, and no dimensional information is provided in the request. + for (uint32_t i = 0; i < outputShapes.size(); i++) { + ASSERT_EQ(outputShapes[i].isSufficient, i != kInsufficientOutputIndex); + const auto& actual = outputShapes[i].dimensions; + const auto& golden = + testModel.main.operands[testModel.main.outputIndexes[i]].dimensions; + ASSERT_EQ(actual.size(), golden.size()); + for (uint32_t j = 0; j < actual.size(); j++) { + if (actual[j] == 0) continue; + EXPECT_EQ(actual[j], golden[j]) << "index: " << j; + } + } return; case OutputType::MISSED_DEADLINE: ASSERT_TRUE(executionStatus == ErrorStatus::MISSED_DEADLINE_TRANSIENT || |