diff options
author | Matthew Sloyan <matthew.sloyan@arm.com> | 2023-04-28 17:27:26 +0100 |
---|---|---|
committer | Matthew Sloyan <matthew.sloyan@arm.com> | 2023-05-02 11:03:23 +0000 |
commit | c49aacc83370e89435129650a30ef1b384712dfe (patch) | |
tree | 5d077bcc282505e68953cddbdea47d919be2b67f /delegate/classic | |
parent | e9b81a4571edc238a582e45d14d29ba346da18a9 (diff) | |
download | armnn-c49aacc83370e89435129650a30ef1b384712dfe.tar.gz |
IVGCVSW-7603 Implement Reshape operators for Opaque Delegate
* Moved CreateOutputTensorShape function to common DelegateUtils.hpp
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com>
Change-Id: I3d8a9834ecd6b7cda170cce958677a0dde62824a
Diffstat (limited to 'delegate/classic')
-rw-r--r-- | delegate/classic/src/Redefine.hpp | 31 |
1 files changed, 0 insertions, 31 deletions
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 <tensorflow/lite/c/builtin_op_data.h> #include <tensorflow/lite/c/common.h> #include <tensorflow/lite/minimal_logging.h> -#include <numeric> namespace armnnDelegate { @@ -84,36 +83,6 @@ TfLiteStatus VisitCastOperator(DelegateData& delegateData, return Connect(layer, tfLiteNode, delegateData); } - -TfLiteStatus CreateOutputTensorShape(const armnn::TensorInfo& inputTensorInfo, - const std::vector<int32_t>& targetShape, - armnn::ReshapeDescriptor& reshapeDesc) -{ - std::vector<unsigned int> 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<unsigned int>( - std::accumulate(targetShape.begin(), targetShape.end(), -1, std::multiplies<int32_t>())); - - auto stretchIndex = static_cast<size_t>(std::distance(targetShape.begin(), stretchDim)); - outputDims[stretchIndex] = inputTensorInfo.GetNumElements() / targetNumElements; - } - - armnn::TensorShape outputShape = armnn::TensorShape(static_cast<unsigned int>(outputDims.size()), - outputDims.data()); - reshapeDesc.m_TargetShape = outputShape; - return kTfLiteOk; -} - TfLiteStatus VisitReshapeOperator(DelegateData& delegateData, TfLiteContext* tfLiteContext, TfLiteNode* tfLiteNode, |