summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Butler <butlermichael@google.com>2020-05-26 14:40:05 -0700
committerMichael Butler <butlermichael@google.com>2020-05-26 16:00:49 -0700
commitc38e37d7e7a787b5ef602a51119ed544e9f1842a (patch)
tree13e5fb07fbfe24a459117453ec0aae4e9eaa98ea
parent66e5923200afc965bf19b880737e9180e9f5c909 (diff)
downloadml-c38e37d7e7a787b5ef602a51119ed544e9f1842a.tar.gz
Omit dimensions for HAS_NO_VALUE operands
Bug: 157268934 Test: mma Test: libneuralnetworks_fuzzer Change-Id: I5d78db36b110eaec2230478c4759f94f386d59c3
-rw-r--r--nn/runtime/ExecutionBuilder.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/nn/runtime/ExecutionBuilder.cpp b/nn/runtime/ExecutionBuilder.cpp
index 61e320f9a..d65d96446 100644
--- a/nn/runtime/ExecutionBuilder.cpp
+++ b/nn/runtime/ExecutionBuilder.cpp
@@ -876,7 +876,11 @@ std::vector<OutputShape> ExecutionBuilder::getInitialOutputShapes() const {
std::vector<OutputShape> outputShapes(mOutputs.size());
std::transform(mOutputs.begin(), mOutputs.end(), outputShapes.begin(),
[](const auto& x) -> OutputShape {
- return {.dimensions = x.dimensions(), .isSufficient = true};
+ hidl_vec<uint32_t> dimensions;
+ if (x.state() != ModelArgumentInfo::HAS_NO_VALUE) {
+ dimensions = x.dimensions();
+ }
+ return {.dimensions = std::move(dimensions), .isSufficient = true};
});
return outputShapes;
}