Laurent Carlier | 749294b | 2020-06-01 09:03:17 +0100 | [diff] [blame] | 1 | // |
Teresa Charlin | 50de4fa | 2021-05-31 18:47:33 +0100 | [diff] [blame] | 2 | // Copyright © 2017 Arm Ltd and Contributors. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
| 5 | #pragma once |
| 6 | |
| 7 | #include <array> |
Matthew Bentham | 47bfac4 | 2019-03-25 12:30:56 +0000 | [diff] [blame] | 8 | #include <functional> |
janeil01 | c4946c7 | 2019-11-07 09:32:28 +0000 | [diff] [blame] | 9 | #include <stdint.h> |
Keith Davis | e813d67 | 2021-04-22 10:10:34 +0100 | [diff] [blame] | 10 | #include <chrono> |
Jim Flynn | 44db7c3 | 2019-03-22 15:58:39 +0000 | [diff] [blame] | 11 | #include "BackendId.hpp" |
| 12 | #include "Exceptions.hpp" |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 13 | #include "Deprecated.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 14 | |
| 15 | namespace armnn |
| 16 | { |
| 17 | |
Matthew Jackson | dba634f | 2019-08-15 15:14:18 +0100 | [diff] [blame] | 18 | constexpr unsigned int MaxNumOfTensorDimensions = 5U; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 19 | |
Ryan OShea | 2bbfaa7 | 2020-02-12 16:15:27 +0000 | [diff] [blame] | 20 | /// The lowest performance data capture interval we support is 10 miliseconds. |
Colm Donelan | 0270524 | 2019-11-14 14:19:07 +0000 | [diff] [blame] | 21 | constexpr unsigned int LOWEST_CAPTURE_PERIOD = 10000u; |
| 22 | |
Keith Davis | e813d67 | 2021-04-22 10:10:34 +0100 | [diff] [blame] | 23 | /// Variable to control expire rate of priority queue |
| 24 | constexpr unsigned int EXPIRE_RATE = 3U; |
| 25 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 26 | /// @enum Status enumeration |
| 27 | /// @var Status::Successful |
| 28 | /// @var Status::Failure |
| 29 | enum class Status |
| 30 | { |
| 31 | Success = 0, |
| 32 | Failure = 1 |
| 33 | }; |
| 34 | |
| 35 | enum class DataType |
| 36 | { |
Keith Davis | e813d67 | 2021-04-22 10:10:34 +0100 | [diff] [blame] | 37 | Float16 = 0, |
| 38 | Float32 = 1, |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 39 | QAsymmU8 = 2, |
ruoyan01 | 20e984f | 2018-12-12 18:11:25 +0000 | [diff] [blame] | 40 | Signed32 = 3, |
Keith Davis | e813d67 | 2021-04-22 10:10:34 +0100 | [diff] [blame] | 41 | Boolean = 4, |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 42 | QSymmS16 = 5, |
Derek Lamberti | d466a54 | 2020-01-22 15:37:29 +0000 | [diff] [blame] | 43 | QuantizedSymm8PerAxis ARMNN_DEPRECATED_ENUM_MSG("Per Axis property inferred by number of scales in TensorInfo") = 6, |
Keith Davis | e813d67 | 2021-04-22 10:10:34 +0100 | [diff] [blame] | 44 | QSymmS8 = 7, |
Ryan OShea | 9add120 | 2020-02-07 10:06:33 +0000 | [diff] [blame] | 45 | QAsymmS8 = 8, |
Narumol Prangnawarat | c3bf6ef | 2020-02-28 12:45:21 +0000 | [diff] [blame] | 46 | BFloat16 = 9, |
Inki Dae | d4619e2 | 2020-09-10 15:33:54 +0900 | [diff] [blame] | 47 | Signed64 = 10, |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 48 | |
Derek Lamberti | 41e92b0 | 2020-01-21 13:43:21 +0000 | [diff] [blame] | 49 | QuantisedAsymm8 ARMNN_DEPRECATED_ENUM_MSG("Use DataType::QAsymmU8 instead.") = QAsymmU8, |
| 50 | QuantisedSymm16 ARMNN_DEPRECATED_ENUM_MSG("Use DataType::QSymmS16 instead.") = QSymmS16 |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
Derek Lamberti | 0cff163 | 2018-09-18 16:02:25 +0100 | [diff] [blame] | 53 | enum class DataLayout |
| 54 | { |
| 55 | NCHW = 1, |
Matthew Sloyan | b63a311 | 2021-09-08 13:05:51 +0100 | [diff] [blame^] | 56 | NHWC = 2, |
| 57 | NDHWC = 3 |
Derek Lamberti | 0cff163 | 2018-09-18 16:02:25 +0100 | [diff] [blame] | 58 | }; |
| 59 | |
Keith Davis | 4914d0c | 2021-08-18 17:14:05 +0100 | [diff] [blame] | 60 | /// Define the behaviour of the internal profiler when outputting network details |
| 61 | enum class ProfilingDetailsMethod |
| 62 | { |
| 63 | Undefined = 0, |
| 64 | DetailsWithEvents = 1, |
| 65 | DetailsOnly = 2 |
| 66 | }; |
| 67 | |
| 68 | |
Keith Davis | e813d67 | 2021-04-22 10:10:34 +0100 | [diff] [blame] | 69 | enum class QosExecPriority |
| 70 | { |
| 71 | Low = 0, |
| 72 | Medium = 1, |
| 73 | High = 2 |
| 74 | }; |
| 75 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 76 | enum class ActivationFunction |
| 77 | { |
| 78 | Sigmoid = 0, |
| 79 | TanH = 1, |
| 80 | Linear = 2, |
| 81 | ReLu = 3, |
Colm Donelan | 03fbeaf | 2020-02-26 15:39:23 +0000 | [diff] [blame] | 82 | BoundedReLu = 4, ///< min(a, max(b, input)) ReLu1 & ReLu6. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 83 | SoftReLu = 5, |
| 84 | LeakyReLu = 6, |
| 85 | Abs = 7, |
| 86 | Sqrt = 8, |
David Monahan | 3b3c381 | 2020-02-25 09:03:29 +0000 | [diff] [blame] | 87 | Square = 9, |
Colm Donelan | 03fbeaf | 2020-02-26 15:39:23 +0000 | [diff] [blame] | 88 | Elu = 10, |
| 89 | HardSwish = 11 |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 90 | }; |
| 91 | |
Narumol Prangnawarat | 8d001d4 | 2019-09-09 15:01:18 +0100 | [diff] [blame] | 92 | enum class ArgMinMaxFunction |
| 93 | { |
| 94 | Min = 0, |
| 95 | Max = 1 |
| 96 | }; |
| 97 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 98 | enum class ComparisonOperation |
| 99 | { |
| 100 | Equal = 0, |
| 101 | Greater = 1, |
| 102 | GreaterOrEqual = 2, |
| 103 | Less = 3, |
| 104 | LessOrEqual = 4, |
| 105 | NotEqual = 5 |
| 106 | }; |
| 107 | |
James Conroy | aba90cd | 2020-11-06 16:28:18 +0000 | [diff] [blame] | 108 | enum class LogicalBinaryOperation |
| 109 | { |
| 110 | LogicalAnd = 0, |
| 111 | LogicalOr = 1 |
| 112 | }; |
| 113 | |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 114 | enum class UnaryOperation |
| 115 | { |
James Conroy | aba90cd | 2020-11-06 16:28:18 +0000 | [diff] [blame] | 116 | Abs = 0, |
| 117 | Exp = 1, |
| 118 | Sqrt = 2, |
| 119 | Rsqrt = 3, |
| 120 | Neg = 4, |
Teresa Charlin | 50de4fa | 2021-05-31 18:47:33 +0100 | [diff] [blame] | 121 | LogicalNot = 5, |
| 122 | Log = 6, |
| 123 | Sin = 7 |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 124 | }; |
| 125 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 126 | enum class PoolingAlgorithm |
| 127 | { |
| 128 | Max = 0, |
| 129 | Average = 1, |
| 130 | L2 = 2 |
| 131 | }; |
| 132 | |
Sadik Armagan | 0c3ea5b | 2021-02-03 09:29:30 +0000 | [diff] [blame] | 133 | enum class ReduceOperation |
| 134 | { |
| 135 | Sum = 0, |
| 136 | Max = 1, |
| 137 | Mean = 2, |
Teresa Charlin | 4e3e831 | 2021-08-05 12:34:37 +0100 | [diff] [blame] | 138 | Min = 3, |
| 139 | Prod = 4 |
Sadik Armagan | 0c3ea5b | 2021-02-03 09:29:30 +0000 | [diff] [blame] | 140 | }; |
| 141 | |
Teresa Charlin | a9075df | 2019-06-27 15:41:57 +0100 | [diff] [blame] | 142 | enum class ResizeMethod |
| 143 | { |
| 144 | Bilinear = 0, |
| 145 | NearestNeighbor = 1 |
| 146 | }; |
| 147 | |
Teresa Charlin | 11f6ace | 2020-06-23 18:30:57 +0100 | [diff] [blame] | 148 | enum class Dimensionality |
| 149 | { |
| 150 | NotSpecified = 0, |
| 151 | Specified = 1, |
| 152 | Scalar = 2 |
| 153 | }; |
| 154 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 155 | /// |
| 156 | /// The padding method modifies the output of pooling layers. |
| 157 | /// In both supported methods, the values are ignored (they are |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 158 | /// not even zeroes, which would make a difference for max pooling |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 159 | /// a tensor with negative values). The difference between |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 160 | /// IgnoreValue and Exclude is that the former counts the padding |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 161 | /// fields in the divisor of Average and L2 pooling, while |
| 162 | /// Exclude does not. |
| 163 | /// |
| 164 | enum class PaddingMethod |
| 165 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 166 | /// The padding fields count, but are ignored |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 167 | IgnoreValue = 0, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 168 | /// The padding fields don't count and are ignored |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 169 | Exclude = 1 |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 170 | }; |
| 171 | |
| 172 | enum class NormalizationAlgorithmChannel |
| 173 | { |
| 174 | Across = 0, |
| 175 | Within = 1 |
| 176 | }; |
| 177 | |
| 178 | enum class NormalizationAlgorithmMethod |
| 179 | { |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 180 | /// Krichevsky 2012: Local Brightness Normalization |
| 181 | LocalBrightness = 0, |
| 182 | /// Jarret 2009: Local Contrast Normalization |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 183 | LocalContrast = 1 |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 184 | }; |
| 185 | |
| 186 | enum class OutputShapeRounding |
| 187 | { |
| 188 | Floor = 0, |
| 189 | Ceiling = 1 |
| 190 | }; |
| 191 | |
Teresa Charlin | cdc0149 | 2020-06-09 18:00:20 +0100 | [diff] [blame] | 192 | /// |
| 193 | /// The ShapeInferenceMethod modify how the output shapes are treated. |
| 194 | /// When ValidateOnly is selected, the output shapes are inferred from the input parameters of the layer |
| 195 | /// and any mismatch is reported. |
| 196 | /// When InferAndValidate is selected 2 actions must be performed: (1)infer output shape from inputs and (2)validate the |
| 197 | /// shapes as in ValidateOnly. This option has been added to work with tensors which rank or dimension sizes are not |
| 198 | /// specified explicitly, however this information can be calculated from the inputs. |
| 199 | /// |
| 200 | enum class ShapeInferenceMethod |
| 201 | { |
| 202 | /// Validate all output shapes |
| 203 | ValidateOnly = 0, |
| 204 | /// Infer missing output shapes and validate all output shapes |
| 205 | InferAndValidate = 1 |
| 206 | }; |
| 207 | |
Francis Murtagh | 73d3e2e | 2021-04-29 14:23:04 +0100 | [diff] [blame] | 208 | /// Define the Memory Source to reduce copies |
| 209 | enum class MemorySource : uint32_t |
| 210 | { |
| 211 | Undefined = 0, |
| 212 | Malloc = 1, |
| 213 | DmaBuf = 2, |
| 214 | DmaBufProtected = 4 |
| 215 | }; |
| 216 | |
Sadik Armagan | 932cf3f | 2021-09-15 09:22:11 +0100 | [diff] [blame] | 217 | enum class MemBlockStrategyType |
| 218 | { |
| 219 | // MemBlocks can be packed on the Y axis only. |
| 220 | // In other words MemBlocks with overlapping lifetimes cannot use the same MemBin, |
| 221 | // equivalent to blob or pooling memory management. |
| 222 | SingleAxisPacking = 0, |
| 223 | |
| 224 | // MemBlocks can be packed on the Y and X axis. |
| 225 | // In other words MemBlocks with overlapping lifetimes can use the same MemBin, |
| 226 | // equivalent to offset or slab memory management. |
| 227 | MultiAxisPacking = 1 |
| 228 | }; |
| 229 | |
David Beck | 9efb57d | 2018-11-05 13:40:33 +0000 | [diff] [blame] | 230 | /// Each backend should implement an IBackend. |
| 231 | class IBackend |
| 232 | { |
| 233 | protected: |
| 234 | IBackend() {} |
| 235 | virtual ~IBackend() {} |
| 236 | |
| 237 | public: |
| 238 | virtual const BackendId& GetId() const = 0; |
| 239 | }; |
| 240 | |
| 241 | using IBackendSharedPtr = std::shared_ptr<IBackend>; |
| 242 | using IBackendUniquePtr = std::unique_ptr<IBackend, void(*)(IBackend* backend)>; |
| 243 | |
Sadik Armagan | f0a6dec | 2021-03-25 07:46:55 +0000 | [diff] [blame] | 244 | /// BackendCapability class |
| 245 | enum class BackendCapability : uint32_t |
| 246 | { |
| 247 | /// Constant weights can be accessed through the descriptors, |
| 248 | /// On the other hand, non-const weights can be accessed through inputs. |
| 249 | NonConstWeights, |
| 250 | |
Sadik Armagan | aede8ca | 2021-03-31 16:12:13 +0100 | [diff] [blame] | 251 | /// Asynchronous Execution. |
| 252 | AsyncExecution, |
| 253 | |
Sadik Armagan | f0a6dec | 2021-03-25 07:46:55 +0000 | [diff] [blame] | 254 | // add new enum values here |
| 255 | }; |
| 256 | |
David Beck | dcb751f | 2018-10-03 11:42:42 +0100 | [diff] [blame] | 257 | /// Device specific knowledge to be passed to the optimizer. |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 258 | class IDeviceSpec |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 259 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 260 | protected: |
Matteo Martincigh | 9c5d33a | 2019-02-07 17:52:41 +0000 | [diff] [blame] | 261 | IDeviceSpec() {} |
| 262 | virtual ~IDeviceSpec() {} |
Narumol Prangnawarat | 8710676 | 2019-05-03 15:54:39 +0100 | [diff] [blame] | 263 | public: |
| 264 | virtual const BackendIdSet& GetSupportedBackends() const = 0; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 265 | }; |
| 266 | |
| 267 | /// Type of identifiers for bindable layers (inputs, outputs). |
| 268 | using LayerBindingId = int; |
Finn Williams | f37b970 | 2021-09-01 18:06:04 +0100 | [diff] [blame] | 269 | using ImportedInputId = unsigned int; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 270 | |
| 271 | class PermutationVector |
| 272 | { |
| 273 | public: |
| 274 | using ValueType = unsigned int; |
| 275 | using SizeType = unsigned int; |
| 276 | using ArrayType = std::array<ValueType, MaxNumOfTensorDimensions>; |
| 277 | using ConstIterator = typename ArrayType::const_iterator; |
| 278 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 279 | /// @param dimMappings - Indicates how to translate tensor elements from a given source into the target destination, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 280 | /// when source and target potentially have different memory layouts. |
| 281 | /// |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 282 | /// E.g. For a 4-d tensor laid out in a memory with the format (Batch Element, Height, Width, Channels), |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 283 | /// which is to be passed as an input to ArmNN, each source dimension is mapped to the corresponding |
| 284 | /// ArmNN dimension. The Batch dimension remains the same (0 -> 0). The source Height dimension is mapped |
| 285 | /// to the location of the ArmNN Height dimension (1 -> 2). Similar arguments are made for the Width and |
| 286 | /// Channels (2 -> 3 and 3 -> 1). This will lead to @ref m_DimMappings pointing to the following array: |
| 287 | /// [ 0, 2, 3, 1 ]. |
| 288 | /// |
| 289 | /// Note that the mapping should be reversed if considering the case of ArmNN 4-d outputs (Batch Element, |
| 290 | /// Channels, Height, Width) being written to a destination with the format mentioned above. We now have |
| 291 | /// 0 -> 0, 2 -> 1, 3 -> 2, 1 -> 3, which, when reordered, lead to the following @ref m_DimMappings contents: |
| 292 | /// [ 0, 3, 1, 2 ]. |
| 293 | /// |
| 294 | PermutationVector(const ValueType *dimMappings, SizeType numDimMappings); |
| 295 | |
| 296 | PermutationVector(std::initializer_list<ValueType> dimMappings); |
| 297 | |
| 298 | ValueType operator[](SizeType i) const { return m_DimMappings.at(i); } |
| 299 | |
| 300 | SizeType GetSize() const { return m_NumDimMappings; } |
| 301 | |
| 302 | ConstIterator begin() const { return m_DimMappings.begin(); } |
Colm Donelan | 41e764c | 2021-05-27 16:43:25 +0100 | [diff] [blame] | 303 | /** |
| 304 | * |
| 305 | * @return pointer one past the end of the number of mapping not the length of m_DimMappings. |
| 306 | */ |
| 307 | ConstIterator end() const { return m_DimMappings.begin() + m_NumDimMappings; } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 308 | |
| 309 | bool IsEqual(const PermutationVector& other) const |
| 310 | { |
Matthew Jackson | dba634f | 2019-08-15 15:14:18 +0100 | [diff] [blame] | 311 | if (m_NumDimMappings != other.m_NumDimMappings) return false; |
| 312 | for (unsigned int i = 0; i < m_NumDimMappings; ++i) |
| 313 | { |
| 314 | if (m_DimMappings[i] != other.m_DimMappings[i]) return false; |
| 315 | } |
| 316 | return true; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | bool IsInverse(const PermutationVector& other) const |
| 320 | { |
| 321 | bool isInverse = (GetSize() == other.GetSize()); |
| 322 | for (SizeType i = 0; isInverse && (i < GetSize()); ++i) |
| 323 | { |
| 324 | isInverse = (m_DimMappings[other.m_DimMappings[i]] == i); |
| 325 | } |
| 326 | return isInverse; |
| 327 | } |
| 328 | |
| 329 | private: |
| 330 | ArrayType m_DimMappings; |
| 331 | /// Number of valid entries in @ref m_DimMappings |
| 332 | SizeType m_NumDimMappings; |
| 333 | }; |
| 334 | |
janeil01 | 3fec1ea | 2019-11-07 09:47:20 +0000 | [diff] [blame] | 335 | namespace profiling { class ProfilingGuid; } |
| 336 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 337 | /// Define LayerGuid type. |
janeil01 | 3fec1ea | 2019-11-07 09:47:20 +0000 | [diff] [blame] | 338 | using LayerGuid = profiling::ProfilingGuid; |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 339 | |
Nattapat Chaimanowong | 6e94820 | 2019-03-22 14:01:46 +0000 | [diff] [blame] | 340 | class ITensorHandle; |
| 341 | |
Nattapat Chaimanowong | 317cae5 | 2019-03-28 10:29:12 +0000 | [diff] [blame] | 342 | /// Define the type of callback for the Debug layer to call |
| 343 | /// @param guid - guid of layer connected to the input of the Debug layer |
| 344 | /// @param slotIndex - index of the output slot connected to the input of the Debug layer |
| 345 | /// @param tensorHandle - TensorHandle for the input tensor to the Debug layer |
| 346 | using DebugCallbackFunction = std::function<void(LayerGuid guid, unsigned int slotIndex, ITensorHandle* tensorHandle)>; |
Nattapat Chaimanowong | 6e94820 | 2019-03-22 14:01:46 +0000 | [diff] [blame] | 347 | |
Keith Davis | e813d67 | 2021-04-22 10:10:34 +0100 | [diff] [blame] | 348 | /// Define a timer and associated inference ID for recording execution times |
| 349 | using HighResolutionClock = std::chrono::high_resolution_clock::time_point; |
| 350 | using InferenceTimingPair = std::pair<HighResolutionClock, HighResolutionClock>; |
janeil01 | c4946c7 | 2019-11-07 09:32:28 +0000 | [diff] [blame] | 351 | |
janeil01 | c4946c7 | 2019-11-07 09:32:28 +0000 | [diff] [blame] | 352 | |
Finn Williams | b454c5c | 2021-02-09 15:56:23 +0000 | [diff] [blame] | 353 | /// This list uses X macro technique. |
| 354 | /// See https://en.wikipedia.org/wiki/X_Macro for more info |
| 355 | #define LIST_OF_LAYER_TYPE \ |
| 356 | X(Activation) \ |
| 357 | X(Addition) \ |
| 358 | X(ArgMinMax) \ |
| 359 | X(BatchNormalization) \ |
Keith Davis | 3ae3f97 | 2021-05-21 16:33:48 +0100 | [diff] [blame] | 360 | X(BatchToSpaceNd) \ |
Finn Williams | b454c5c | 2021-02-09 15:56:23 +0000 | [diff] [blame] | 361 | X(Comparison) \ |
| 362 | X(Concat) \ |
| 363 | X(Constant) \ |
| 364 | X(ConvertBf16ToFp32) \ |
| 365 | X(ConvertFp16ToFp32) \ |
| 366 | X(ConvertFp32ToBf16) \ |
| 367 | X(ConvertFp32ToFp16) \ |
| 368 | X(Convolution2d) \ |
| 369 | X(Debug) \ |
| 370 | X(DepthToSpace) \ |
| 371 | X(DepthwiseConvolution2d) \ |
| 372 | X(Dequantize) \ |
| 373 | X(DetectionPostProcess) \ |
| 374 | X(Division) \ |
| 375 | X(ElementwiseUnary) \ |
| 376 | X(FakeQuantization) \ |
| 377 | X(Fill) \ |
| 378 | X(Floor) \ |
| 379 | X(FullyConnected) \ |
| 380 | X(Gather) \ |
| 381 | X(Input) \ |
| 382 | X(InstanceNormalization) \ |
| 383 | X(L2Normalization) \ |
| 384 | X(LogicalBinary) \ |
| 385 | X(LogSoftmax) \ |
| 386 | X(Lstm) \ |
| 387 | X(QLstm) \ |
| 388 | X(Map) \ |
| 389 | X(Maximum) \ |
| 390 | X(Mean) \ |
| 391 | X(MemCopy) \ |
| 392 | X(MemImport) \ |
| 393 | X(Merge) \ |
| 394 | X(Minimum) \ |
| 395 | X(Multiplication) \ |
| 396 | X(Normalization) \ |
| 397 | X(Output) \ |
| 398 | X(Pad) \ |
| 399 | X(Permute) \ |
| 400 | X(Pooling2d) \ |
| 401 | X(PreCompiled) \ |
| 402 | X(Prelu) \ |
| 403 | X(Quantize) \ |
| 404 | X(QuantizedLstm) \ |
| 405 | X(Reshape) \ |
| 406 | X(Rank) \ |
| 407 | X(Resize) \ |
| 408 | X(Reduce) \ |
| 409 | X(Slice) \ |
| 410 | X(Softmax) \ |
| 411 | X(SpaceToBatchNd) \ |
| 412 | X(SpaceToDepth) \ |
| 413 | X(Splitter) \ |
| 414 | X(Stack) \ |
| 415 | X(StandIn) \ |
| 416 | X(StridedSlice) \ |
| 417 | X(Subtraction) \ |
| 418 | X(Switch) \ |
| 419 | X(Transpose) \ |
| 420 | X(TransposeConvolution2d) \ |
mathad01 | b392e98 | 2021-04-07 12:07:30 +0100 | [diff] [blame] | 421 | X(Unmap) \ |
Narumol Prangnawarat | 8ed39ae | 2021-07-15 16:16:25 +0100 | [diff] [blame] | 422 | X(Cast) \ |
| 423 | X(Shape) \ |
| 424 | X(UnidirectionalSequenceLstm) \ |
Simon Obute | 51f6777 | 2021-09-03 15:50:13 +0100 | [diff] [blame] | 425 | X(ChannelShuffle) \ |
Matthew Sloyan | b63a311 | 2021-09-08 13:05:51 +0100 | [diff] [blame^] | 426 | X(Convolution3d) \ |
| 427 | |
Narumol Prangnawarat | 8ed39ae | 2021-07-15 16:16:25 +0100 | [diff] [blame] | 428 | // New layers should be added at last to minimize instability. |
Keith Davis | 3ae3f97 | 2021-05-21 16:33:48 +0100 | [diff] [blame] | 429 | |
Finn Williams | b454c5c | 2021-02-09 15:56:23 +0000 | [diff] [blame] | 430 | /// When adding a new layer, adapt also the LastLayer enum value in the |
| 431 | /// enum class LayerType below |
| 432 | enum class LayerType |
| 433 | { |
| 434 | #define X(name) name, |
| 435 | LIST_OF_LAYER_TYPE |
| 436 | #undef X |
| 437 | FirstLayer = Activation, |
Narumol Prangnawarat | 8ed39ae | 2021-07-15 16:16:25 +0100 | [diff] [blame] | 438 | LastLayer = UnidirectionalSequenceLstm |
Finn Williams | b454c5c | 2021-02-09 15:56:23 +0000 | [diff] [blame] | 439 | }; |
| 440 | |
| 441 | const char* GetLayerTypeAsCString(LayerType type); |
| 442 | |
David Beck | 9df2d95 | 2018-10-10 15:11:44 +0100 | [diff] [blame] | 443 | } // namespace armnn |