From c49aacc83370e89435129650a30ef1b384712dfe Mon Sep 17 00:00:00 2001 From: Matthew Sloyan Date: Fri, 28 Apr 2023 17:27:26 +0100 Subject: IVGCVSW-7603 Implement Reshape operators for Opaque Delegate * Moved CreateOutputTensorShape function to common DelegateUtils.hpp Signed-off-by: Matthew Sloyan Change-Id: I3d8a9834ecd6b7cda170cce958677a0dde62824a --- delegate/classic/src/Redefine.hpp | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'delegate/classic/src/Redefine.hpp') diff --git a/delegate/classic/src/Redefine.hpp b/delegate/classic/src/Redefine.hpp index 7aef74f76b..41c62c33c8 100644 --- a/delegate/classic/src/Redefine.hpp +++ b/delegate/classic/src/Redefine.hpp @@ -13,7 +13,6 @@ #include #include #include -#include namespace armnnDelegate { @@ -84,36 +83,6 @@ TfLiteStatus VisitCastOperator(DelegateData& delegateData, return Connect(layer, tfLiteNode, delegateData); } - -TfLiteStatus CreateOutputTensorShape(const armnn::TensorInfo& inputTensorInfo, - const std::vector& targetShape, - armnn::ReshapeDescriptor& reshapeDesc) -{ - std::vector outputDims(targetShape.begin(), targetShape.end()); - const auto stretchDim = std::find(targetShape.begin(), targetShape.end(), -1); - - if (stretchDim != targetShape.end()) - { - if (std::find(std::next(stretchDim), targetShape.end(), -1) != targetShape.end()) - { - // Return kTfLiteError and log the error after returning - return kTfLiteError; - } - - auto targetNumElements = - armnn::numeric_cast( - std::accumulate(targetShape.begin(), targetShape.end(), -1, std::multiplies())); - - auto stretchIndex = static_cast(std::distance(targetShape.begin(), stretchDim)); - outputDims[stretchIndex] = inputTensorInfo.GetNumElements() / targetNumElements; - } - - armnn::TensorShape outputShape = armnn::TensorShape(static_cast(outputDims.size()), - outputDims.data()); - reshapeDesc.m_TargetShape = outputShape; - return kTfLiteOk; -} - TfLiteStatus VisitReshapeOperator(DelegateData& delegateData, TfLiteContext* tfLiteContext, TfLiteNode* tfLiteNode, -- cgit v1.2.1