diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp index 7eea7fcedc..f5cb0d7cf5 100644 --- a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp +++ b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp @@ -77,6 +77,13 @@ void copy_back(MixedTyped* dst, const std::vector& ra, char* sr "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 // Test driver for those generated from ml/nn/runtime/test/spec static Return ExecutePreparedModel(sp& preparedModel, @@ -178,17 +185,18 @@ void EvaluatePreparedModel(sp& preparedModel, std::function(index)) outputs_info.resize(index + 1); if (index == 0) { // On OutputType::INSUFFICIENT, set the output operand with index 0 with // buffer size one byte less than needed. if (outputType == OutputType::INSUFFICIENT) { - if (s > 1) + if (s > 1 && !isZeroSized(golden, index)) { s -= 1; - else + } else { sizeLargerThanOne = false; + } } } RequestArgument arg = {