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