From 284e7fc58f3abc92306313b595835c6f4731b8b2 Mon Sep 17 00:00:00 2001 From: Max Bergfelt Date: Thu, 31 Jul 2025 13:12:33 +0200 Subject: [PATCH] MLBEDSW-10998: Interpret tensor missing shape vector as rank 0 Modified the TOSA reader to interpret a missing TOSA tensor shape as rank 0 instead of throwing an error. Change-Id: I41b1f9bdfe42dec69609435599a0822142e53f2f Signed-off-by: Max Bergfelt --- ethosu/regor/tosa/tosa_reader.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ethosu/regor/tosa/tosa_reader.cpp b/ethosu/regor/tosa/tosa_reader.cpp index 3e403482..4c15079d 100644 --- a/ethosu/regor/tosa/tosa_reader.cpp +++ b/ethosu/regor/tosa/tosa_reader.cpp @@ -372,7 +372,13 @@ void TosaReader::LoadGraphs(const tosaFb::TosaGraph *model, std::list *in) -> GraphApi::GraphShape { - GraphApi::GraphShape out; + GraphApi::GraphShape out{}; + // Interpret a missing shape vector as scalar, rank 0 shape. + if ( in == nullptr ) + { + out.count = 0; + return out; + } const auto &buf = SafeDeref(in, "No shape vector"); tosa_assert(buf.size() <= std::size(out.axisNHWC), "Shape rank exceeds maximum allowed"); for ( int i = 0; i < int(buf.size()); i++ ) -- GitLab