Nina Drozd | d41b259 | 2018-11-19 13:03:36 +0000 | [diff] [blame] | 1 | // |
Colm Donelan | a98e79a | 2022-12-06 21:32:29 +0000 | [diff] [blame] | 2 | // Copyright © 2019,2022 Arm Ltd and Contributors. All rights reserved. |
Nina Drozd | d41b259 | 2018-11-19 13:03:36 +0000 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <armnn/TypesUtils.hpp> |
Colm Donelan | a98e79a | 2022-12-06 21:32:29 +0000 | [diff] [blame] | 9 | #include <armnn/Tensor.hpp> |
| 10 | #include <armnn/Types.hpp> |
| 11 | #include <utility> |
| 12 | #include <vector> |
| 13 | |
| 14 | namespace armnn |
| 15 | { |
| 16 | class ITensorHandle; |
| 17 | } // namespace armnn |
Nina Drozd | d41b259 | 2018-11-19 13:03:36 +0000 | [diff] [blame] | 18 | |
| 19 | namespace armnnUtils |
| 20 | { |
| 21 | armnn::TensorShape GetTensorShape(unsigned int numberOfBatches, |
| 22 | unsigned int numberOfChannels, |
| 23 | unsigned int height, |
| 24 | unsigned int width, |
| 25 | const armnn::DataLayout dataLayout); |
| 26 | |
Nina Drozd | d41b259 | 2018-11-19 13:03:36 +0000 | [diff] [blame] | 27 | armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, |
| 28 | unsigned int numberOfChannels, |
| 29 | unsigned int height, |
| 30 | unsigned int width, |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 31 | const armnn::DataLayout dataLayout, |
| 32 | const armnn::DataType dataType); |
| 33 | |
Tamás Nyíri | 7b885b3 | 2021-10-26 14:47:57 +0100 | [diff] [blame] | 34 | armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, |
| 35 | unsigned int numberOfChannels, |
| 36 | unsigned int depth, |
| 37 | unsigned int height, |
| 38 | unsigned int width, |
| 39 | const armnn::DataLayout dataLayout, |
| 40 | const armnn::DataType dataType); |
| 41 | |
Jim Flynn | f92dfce | 2019-05-02 11:33:25 +0100 | [diff] [blame] | 42 | std::pair<float, float> FindMinMax(armnn::ITensorHandle* tensorHandle); |
| 43 | |
Narumol Prangnawarat | 0280785 | 2019-09-11 16:43:09 +0100 | [diff] [blame] | 44 | armnn::TensorShape ExpandDims(const armnn::TensorShape& tensorShape, int axis); |
| 45 | |
Mike Kelly | 80512b0 | 2022-05-16 23:10:42 +0100 | [diff] [blame] | 46 | std::vector<unsigned int> SqueezeDims(const armnn::TensorShape& tensorShape); |
| 47 | |
Narumol Prangnawarat | 4dc64a6 | 2019-09-16 17:00:22 +0100 | [diff] [blame] | 48 | unsigned int GetNumElementsBetween(const armnn::TensorShape& shape, |
| 49 | unsigned int firstAxisInclusive, |
| 50 | unsigned int lastAxisExclusive); |
| 51 | |
| 52 | unsigned int GetUnsignedAxis(const unsigned int inputDimension, const int axis); |
| 53 | |
Aron Virginas-Tar | b67f957 | 2019-11-04 15:00:19 +0000 | [diff] [blame] | 54 | unsigned int GetNumElementsAfter(const armnn::TensorShape& shape, unsigned int axis); |
Keith Davis | 5236e1d | 2019-11-04 08:58:33 +0000 | [diff] [blame] | 55 | |
Aron Virginas-Tar | b67f957 | 2019-11-04 15:00:19 +0000 | [diff] [blame] | 56 | std::pair<unsigned int, std::vector<float>> GetPerAxisParams(const armnn::TensorInfo& info); |
Keith Davis | 5236e1d | 2019-11-04 08:58:33 +0000 | [diff] [blame] | 57 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 58 | } // namespace armnnUtils |