diff options
author | Matthew Sloyan <matthew.sloyan@arm.com> | 2023-04-26 11:42:46 +0100 |
---|---|---|
committer | Matthew Sloyan <matthew.sloyan@arm.com> | 2023-04-26 11:36:49 +0000 |
commit | 2b04ec3b94da152281fbbc69f8539378589b1f56 (patch) | |
tree | 13fd9f3a8ca44cf4f3a53ccf3f44960cfe627475 /delegate/common | |
parent | f2dffdb00bdf3108ebda6aaa142249d208f0c507 (diff) | |
download | armnn-2b04ec3b94da152281fbbc69f8539378589b1f56.tar.gz |
IVGCVSW-7579 IVGCVSW-7581 IVGCVSW-7583 Implement Comparison, Concat and Mean in Opaque Delegate
* Removed input slot check from Connect function as number of TFLite
and Arm NN inputs can differ.
* Moved SetupConcatViewOrigin function to DelegateUtils.hpp
* Simplified validation checks in VistConvolution functions as IsValid
and IsDynamic were already being called.
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com>
Change-Id: I858dbe4b643f9d350d9c38ea255ce5effbda4612
Diffstat (limited to 'delegate/common')
-rw-r--r-- | delegate/common/src/DelegateUtils.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/delegate/common/src/DelegateUtils.hpp b/delegate/common/src/DelegateUtils.hpp index b953699016..51c70f9ba1 100644 --- a/delegate/common/src/DelegateUtils.hpp +++ b/delegate/common/src/DelegateUtils.hpp @@ -109,4 +109,33 @@ void UpdateConstantTensorOutputs(const armnn::TensorInfo& inputInfo, armnn::Tens } } +void SetupConcatViewOrigin(const armnn::TensorInfo& inputTensorInfo, + armnn::OriginsDescriptor& concatDescriptor, + const unsigned int concatAxis, + unsigned int inputIndex, + unsigned int& mergeDimOrigin) +{ + const uint32_t inputRank = concatDescriptor.GetNumDimensions(); + + // double check dimensions of the tensors + if (inputTensorInfo.GetNumDimensions() != inputRank) + { + throw armnn::ParseException("The number of dimensions for input tensors " + "of the concatenation operator should be: " + std::to_string(inputRank)); + } + + for (unsigned int j = 0; j < concatAxis; ++j) + { + concatDescriptor.SetViewOriginCoord(inputIndex, j, 0); + } + + concatDescriptor.SetViewOriginCoord(inputIndex, concatAxis, mergeDimOrigin); + mergeDimOrigin += inputTensorInfo.GetShape()[concatAxis]; + + for (unsigned int j = concatAxis + 1; j < inputRank; ++j) + { + concatDescriptor.SetViewOriginCoord(inputIndex, j, 0); + } +} + } // namespace anonymous |