From d08d66158820b45cfaac9da3b643635d4a286852 Mon Sep 17 00:00:00 2001 From: Fredrik Svedberg Date: Fri, 6 Dec 2024 11:28:34 +0100 Subject: [PATCH] MLBEDSW-9979 FullyConnected with keep_num_dims The TFLite reader now handles FullyConnected operations with keep_num_dims = true. Change-Id: I72a0a557e471afc4f27189ad8eb4c4249ae0e8b4 Signed-off-by: Fredrik Svedberg --- ethosu/regor/tflite/tflite_reader.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ethosu/regor/tflite/tflite_reader.cpp b/ethosu/regor/tflite/tflite_reader.cpp index 24ec3cb0..2491d018 100644 --- a/ethosu/regor/tflite/tflite_reader.cpp +++ b/ethosu/regor/tflite/tflite_reader.cpp @@ -553,6 +553,14 @@ void TfLiteReader::ParseOperatorOptions(const std::shared_ptr &operat auto biasTens = std::make_shared(weight_tensor->Name() + "_bias", biasType, Shape(1, 1, 1, elems), buf); operation->ConnectInput(TensorUsage::Scales, biasTens); } + if ( options->keep_num_dims() ) + { + auto &ofmShape = operation->Output(TensorUsage::OFM)->shape; + assert(ofmShape[1] <= weight_tensor->StorageShape()[0]); + ofmShape = Shape(ofmShape[0], ofmShape[1]); + auto &ifmShape = operation->Input(TensorUsage::IFM)->shape; + ifmShape = Shape(ofmShape[0], ifmShape[-1]); + } } break; -- GitLab