Skip OUTPUT_INSUFFICIENT_SIZE test for zero-sized output.
Bug: 126737477
Test: 1.2 VTS with sample driver
Change-Id: I04afd962ed45eac16aacfa9664ad80ba0d4f5855
Merged-In: I04afd962ed45eac16aacfa9664ad80ba0d4f5855
(cherry picked from commit d293315d93
)
This commit is contained in:
parent
41be3682a3
commit
0237edd144
1 changed files with 11 additions and 3 deletions
|
@ -77,6 +77,13 @@ void copy_back(MixedTyped* dst, const std::vector<RequestArgument>& ra, char* sr
|
||||||
"Number of types in MixedTyped changed, but copy_back function wasn't updated");
|
"Number of types in MixedTyped changed, but copy_back function wasn't updated");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isZeroSized(const MixedTyped& example, uint32_t index) {
|
||||||
|
for (auto i : example.operandDimensions.at(index)) {
|
||||||
|
if (i == 0) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Top level driver for models and examples generated by test_generator.py
|
// Top level driver for models and examples generated by test_generator.py
|
||||||
// Test driver for those generated from ml/nn/runtime/test/spec
|
// Test driver for those generated from ml/nn/runtime/test/spec
|
||||||
static Return<ErrorStatus> ExecutePreparedModel(sp<V1_0::IPreparedModel>& preparedModel,
|
static Return<ErrorStatus> ExecutePreparedModel(sp<V1_0::IPreparedModel>& preparedModel,
|
||||||
|
@ -178,17 +185,18 @@ void EvaluatePreparedModel(sp<T_IPreparedModel>& preparedModel, std::function<bo
|
||||||
// Go through all outputs, initialize RequestArgument descriptors
|
// Go through all outputs, initialize RequestArgument descriptors
|
||||||
resize_accordingly(golden, test);
|
resize_accordingly(golden, test);
|
||||||
bool sizeLargerThanOne = true;
|
bool sizeLargerThanOne = true;
|
||||||
for_all(golden, [&outputs_info, &outputSize, &outputType, &sizeLargerThanOne](
|
for_all(golden, [&golden, &outputs_info, &outputSize, &outputType, &sizeLargerThanOne](
|
||||||
int index, auto, auto s) {
|
int index, auto, auto s) {
|
||||||
if (outputs_info.size() <= static_cast<size_t>(index)) outputs_info.resize(index + 1);
|
if (outputs_info.size() <= static_cast<size_t>(index)) outputs_info.resize(index + 1);
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
// On OutputType::INSUFFICIENT, set the output operand with index 0 with
|
// On OutputType::INSUFFICIENT, set the output operand with index 0 with
|
||||||
// buffer size one byte less than needed.
|
// buffer size one byte less than needed.
|
||||||
if (outputType == OutputType::INSUFFICIENT) {
|
if (outputType == OutputType::INSUFFICIENT) {
|
||||||
if (s > 1)
|
if (s > 1 && !isZeroSized(golden, index)) {
|
||||||
s -= 1;
|
s -= 1;
|
||||||
else
|
} else {
|
||||||
sizeLargerThanOne = false;
|
sizeLargerThanOne = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RequestArgument arg = {
|
RequestArgument arg = {
|
||||||
|
|
Loading…
Reference in a new issue