Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
Derek Lamberti | 0028d1b | 2019-02-20 13:57:42 +0000 | [diff] [blame] | 6 | namespace armnnSerializer; |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 7 | |
| 8 | file_identifier "ARMN"; |
| 9 | |
| 10 | file_extension "armnn"; |
| 11 | |
Mike Kelly | af48401 | 2019-02-20 16:53:11 +0000 | [diff] [blame] | 12 | enum ActivationFunction : byte { |
| 13 | Sigmoid = 0, |
| 14 | TanH = 1, |
| 15 | Linear = 2, |
| 16 | ReLu = 3, |
| 17 | BoundedReLu = 4, |
| 18 | SoftReLu = 5, |
| 19 | LeakyReLu = 6, |
| 20 | Abs = 7, |
| 21 | Sqrt = 8, |
| 22 | Square = 9 |
| 23 | } |
| 24 | |
Narumol Prangnawarat | 0cfcf23 | 2019-09-09 17:16:24 +0100 | [diff] [blame] | 25 | enum ArgMinMaxFunction : byte { |
| 26 | Min = 0, |
| 27 | Max = 1 |
| 28 | } |
| 29 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 30 | enum DataType : byte { |
| 31 | Float16 = 0, |
| 32 | Float32 = 1, |
| 33 | QuantisedAsymm8 = 2, |
| 34 | Signed32 = 3, |
Nattapat Chaimanowong | cd5ac23 | 2019-03-19 12:26:36 +0000 | [diff] [blame] | 35 | Boolean = 4, |
| 36 | QuantisedSymm16 = 5 |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 37 | } |
| 38 | |
Saoirse Stewart | 3166c3e | 2019-02-18 15:24:53 +0000 | [diff] [blame] | 39 | enum DataLayout : byte { |
| 40 | NHWC = 0, |
| 41 | NCHW = 1 |
| 42 | } |
| 43 | |
FinnWilliamsArm | 6fb339a | 2019-06-28 15:07:10 +0100 | [diff] [blame] | 44 | enum ResizeMethod: byte { |
| 45 | NearestNeighbor = 0, |
| 46 | Bilinear = 1, |
| 47 | } |
| 48 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 49 | table TensorInfo { |
| 50 | dimensions:[uint]; |
| 51 | dataType:DataType; |
| 52 | quantizationScale:float = 1.0; |
| 53 | quantizationOffset:int = 0; |
| 54 | } |
| 55 | |
| 56 | struct Connection { |
| 57 | sourceLayerIndex:uint; |
| 58 | outputSlotIndex:uint; |
| 59 | } |
| 60 | |
| 61 | table ByteData { |
| 62 | data:[byte]; |
| 63 | } |
| 64 | |
| 65 | table ShortData { |
| 66 | data:[short]; |
| 67 | } |
| 68 | |
| 69 | table IntData { |
| 70 | data:[int]; |
| 71 | } |
| 72 | |
| 73 | table LongData { |
| 74 | data:[long]; |
| 75 | } |
| 76 | |
| 77 | union ConstTensorData { ByteData, ShortData, IntData, LongData } |
| 78 | |
| 79 | table ConstTensor { |
| 80 | info:TensorInfo; |
| 81 | data:ConstTensorData; |
| 82 | } |
| 83 | |
| 84 | table InputSlot { |
| 85 | index:uint; |
| 86 | connection:Connection; |
| 87 | } |
| 88 | |
| 89 | table OutputSlot { |
| 90 | index:uint; |
| 91 | tensorInfo:TensorInfo; |
| 92 | } |
| 93 | |
| 94 | enum LayerType : uint { |
| 95 | Addition = 0, |
| 96 | Input = 1, |
Sadik Armagan | 5f45027 | 2019-02-12 14:31:45 +0000 | [diff] [blame] | 97 | Multiplication = 2, |
Aron Virginas-Tar | fc413c0 | 2019-02-13 15:41:52 +0000 | [diff] [blame] | 98 | Output = 3, |
Saoirse Stewart | 3166c3e | 2019-02-18 15:24:53 +0000 | [diff] [blame] | 99 | Pooling2d = 4, |
Saoirse Stewart | 263829c | 2019-02-19 15:54:14 +0000 | [diff] [blame] | 100 | Reshape = 5, |
Mike Kelly | a0766c3 | 2019-02-19 17:22:07 +0000 | [diff] [blame] | 101 | Softmax = 6, |
Aron Virginas-Tar | c04125f | 2019-02-19 16:31:08 +0000 | [diff] [blame] | 102 | Convolution2d = 7, |
Mike Kelly | af48401 | 2019-02-20 16:53:11 +0000 | [diff] [blame] | 103 | DepthwiseConvolution2d = 8, |
Nattapat Chaimanowong | 30b0020 | 2019-02-20 17:31:34 +0000 | [diff] [blame] | 104 | Activation = 9, |
Sadik Armagan | dbb0c0c | 2019-02-21 09:01:41 +0000 | [diff] [blame] | 105 | Permute = 10, |
Conor Kennedy | 7627788 | 2019-02-26 08:29:54 +0000 | [diff] [blame] | 106 | FullyConnected = 11, |
Nattapat Chaimanowong | 4528699 | 2019-02-26 15:53:02 +0000 | [diff] [blame] | 107 | Constant = 12, |
Nattapat Chaimanowong | 6b4ed98 | 2019-02-26 17:24:13 +0000 | [diff] [blame] | 108 | SpaceToBatchNd = 13, |
Éanna Ó Catháin | 5888589 | 2019-02-27 16:16:39 +0000 | [diff] [blame] | 109 | BatchToSpaceNd = 14, |
Aron Virginas-Tar | 0fe3245 | 2019-02-28 13:12:47 +0000 | [diff] [blame] | 110 | Division = 15, |
Nattapat Chaimanowong | 235cea5 | 2019-02-28 16:27:30 +0000 | [diff] [blame] | 111 | Minimum = 16, |
Aron Virginas-Tar | 377351e | 2019-02-27 14:42:31 +0000 | [diff] [blame] | 112 | Equal = 17, |
Nina Drozd | 5772878 | 2019-02-27 10:53:27 +0000 | [diff] [blame] | 113 | Maximum = 18, |
Nattapat Chaimanowong | ebb0f9c | 2019-03-01 12:14:06 +0000 | [diff] [blame] | 114 | Normalization = 19, |
Sadik Armagan | 8b42a38 | 2019-03-01 14:24:49 +0000 | [diff] [blame] | 115 | Pad = 20, |
Finn Williams | dd2ba7e | 2019-03-01 11:51:52 +0000 | [diff] [blame] | 116 | Rsqrt = 21, |
ruoyan01 | 8e7fa23 | 2019-02-28 15:09:07 +0000 | [diff] [blame] | 117 | Floor = 22, |
Conor Kennedy | 79ffdf5 | 2019-03-01 14:24:54 +0000 | [diff] [blame] | 118 | BatchNormalization = 23, |
Nattapat Chaimanowong | 6522cdc | 2019-03-01 16:14:13 +0000 | [diff] [blame] | 119 | Greater = 24, |
Conor Kennedy | da1f975 | 2019-03-01 14:37:12 +0000 | [diff] [blame] | 120 | ResizeBilinear = 25, |
Nattapat Chaimanowong | b348521 | 2019-03-04 12:35:39 +0000 | [diff] [blame] | 121 | Subtraction = 26, |
Saoirse Stewart | a1ed73a | 2019-03-04 13:40:12 +0000 | [diff] [blame] | 122 | StridedSlice = 27, |
Sadik Armagan | ac97c8c | 2019-03-04 17:44:21 +0000 | [diff] [blame] | 123 | Gather = 28, |
Jim Flynn | ac25a1b | 2019-02-28 10:40:49 +0000 | [diff] [blame] | 124 | Mean = 29, |
Narumol Prangnawarat | 495701f | 2019-03-07 17:31:34 +0000 | [diff] [blame] | 125 | Merger = 30, |
Jim Flynn | 18ce338 | 2019-03-08 11:08:30 +0000 | [diff] [blame] | 126 | L2Normalization = 31, |
Nattapat Chaimanowong | 3e14a9d | 2019-03-18 12:37:06 +0000 | [diff] [blame] | 127 | Splitter = 32, |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 128 | DetectionPostProcess = 33, |
Derek Lamberti | 87acb27 | 2019-03-27 16:51:31 +0000 | [diff] [blame] | 129 | Lstm = 34, |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 130 | Quantize = 35, |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 131 | Dequantize = 36, |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 132 | Merge = 37, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 133 | Switch = 38, |
Aron Virginas-Tar | aa06714 | 2019-06-11 16:01:44 +0100 | [diff] [blame] | 134 | Concat = 39, |
Ellen Norris-Thompson | 5198247 | 2019-06-19 11:46:21 +0100 | [diff] [blame] | 135 | SpaceToDepth = 40, |
Aron Virginas-Tar | cb54930 | 2019-06-21 13:53:38 +0100 | [diff] [blame] | 136 | Prelu = 41, |
FinnWilliamsArm | 6fb339a | 2019-06-28 15:07:10 +0100 | [diff] [blame] | 137 | TransposeConvolution2d = 42, |
Matthew Jackson | b5433ee | 2019-07-11 15:54:20 +0100 | [diff] [blame] | 138 | Resize = 43, |
Jan Eilers | 5b01a89 | 2019-07-23 09:47:43 +0100 | [diff] [blame] | 139 | Stack = 44, |
FinnWilliamsArm | 4ffcc8f | 2019-09-05 14:34:20 +0100 | [diff] [blame] | 140 | QuantizedLstm = 45, |
Narumol Prangnawarat | 0cfcf23 | 2019-09-09 17:16:24 +0100 | [diff] [blame] | 141 | Abs = 46, |
Aron Virginas-Tar | 2fda80b | 2019-09-18 13:36:52 +0100 | [diff] [blame] | 142 | ArgMinMax = 47, |
Aron Virginas-Tar | da9d2d3 | 2019-09-20 10:42:02 +0100 | [diff] [blame] | 143 | Slice = 48, |
Aron Virginas-Tar | 781ced9 | 2019-10-03 11:15:39 +0100 | [diff] [blame] | 144 | DepthToSpace = 49, |
Sadik Armagan | 2625785 | 2019-10-14 13:00:47 +0100 | [diff] [blame] | 145 | InstanceNormalization = 50, |
Aron Virginas-Tar | e80ebd1 | 2019-10-17 16:11:54 +0100 | [diff] [blame^] | 146 | LogSoftmax = 51, |
| 147 | Comparison = 52 |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | // Base layer table to be used as part of other layers |
| 151 | table LayerBase { |
| 152 | index:uint; |
| 153 | layerName:string; |
| 154 | layerType:LayerType; |
| 155 | inputSlots:[InputSlot]; |
| 156 | outputSlots:[OutputSlot]; |
| 157 | } |
| 158 | |
| 159 | table BindableLayerBase { |
| 160 | base:LayerBase; |
| 161 | layerBindingId:int; |
| 162 | } |
| 163 | |
| 164 | // Table for each layer defined below |
FinnWilliamsArm | 4ffcc8f | 2019-09-05 14:34:20 +0100 | [diff] [blame] | 165 | |
| 166 | table AbsLayer { |
| 167 | base:LayerBase; |
| 168 | } |
| 169 | |
Mike Kelly | af48401 | 2019-02-20 16:53:11 +0000 | [diff] [blame] | 170 | table ActivationLayer { |
| 171 | base:LayerBase; |
| 172 | descriptor:ActivationDescriptor; |
| 173 | } |
| 174 | |
| 175 | table ActivationDescriptor { |
Tee Jung | 86bc3d8 | 2019-10-01 11:25:56 +0900 | [diff] [blame] | 176 | activationFunction:ActivationFunction = Sigmoid; |
Mike Kelly | af48401 | 2019-02-20 16:53:11 +0000 | [diff] [blame] | 177 | a:float; |
| 178 | b:float; |
| 179 | } |
| 180 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 181 | table AdditionLayer { |
| 182 | base:LayerBase; |
| 183 | } |
| 184 | |
Narumol Prangnawarat | 0cfcf23 | 2019-09-09 17:16:24 +0100 | [diff] [blame] | 185 | table ArgMinMaxLayer { |
| 186 | base:LayerBase; |
| 187 | descriptor:ArgMinMaxDescriptor; |
| 188 | } |
| 189 | |
| 190 | table ArgMinMaxDescriptor{ |
Tee Jung | 86bc3d8 | 2019-10-01 11:25:56 +0900 | [diff] [blame] | 191 | argMinMaxFunction:ArgMinMaxFunction; |
Narumol Prangnawarat | 0cfcf23 | 2019-09-09 17:16:24 +0100 | [diff] [blame] | 192 | axis:int; |
| 193 | } |
| 194 | |
Aron Virginas-Tar | e80ebd1 | 2019-10-17 16:11:54 +0100 | [diff] [blame^] | 195 | enum ComparisonOperation : byte { |
| 196 | Equal = 0, |
| 197 | Greater = 1, |
| 198 | GreaterOrEqual = 2, |
| 199 | Less = 3, |
| 200 | LessOrEqual = 4, |
| 201 | NotEqual = 5 |
| 202 | } |
| 203 | |
| 204 | table ComparisonDescriptor { |
| 205 | operation:ComparisonOperation; |
| 206 | } |
| 207 | |
| 208 | table ComparisonLayer { |
| 209 | base:LayerBase; |
| 210 | descriptor:ComparisonDescriptor; |
| 211 | } |
| 212 | |
Conor Kennedy | 7627788 | 2019-02-26 08:29:54 +0000 | [diff] [blame] | 213 | table ConstantLayer { |
| 214 | base:LayerBase; |
| 215 | input:ConstTensor; |
| 216 | } |
| 217 | |
Mike Kelly | a0766c3 | 2019-02-19 17:22:07 +0000 | [diff] [blame] | 218 | table Convolution2dLayer { |
| 219 | base:LayerBase; |
| 220 | descriptor:Convolution2dDescriptor; |
| 221 | weights:ConstTensor; |
| 222 | biases:ConstTensor; |
| 223 | } |
| 224 | |
| 225 | table Convolution2dDescriptor { |
| 226 | padLeft:uint; |
| 227 | padRight:uint; |
| 228 | padTop:uint; |
| 229 | padBottom:uint; |
| 230 | strideX:uint; |
| 231 | strideY:uint; |
Matthew Bentham | acad04e | 2019-05-13 10:02:45 +0100 | [diff] [blame] | 232 | dilationX:uint = 1; |
| 233 | dilationY:uint = 1; |
Mike Kelly | a0766c3 | 2019-02-19 17:22:07 +0000 | [diff] [blame] | 234 | biasEnabled:bool = false; |
| 235 | dataLayout:DataLayout = NCHW; |
| 236 | } |
| 237 | |
Aron Virginas-Tar | da9d2d3 | 2019-09-20 10:42:02 +0100 | [diff] [blame] | 238 | table DepthToSpaceLayer { |
| 239 | base:LayerBase; |
| 240 | descriptor:DepthToSpaceDescriptor; |
| 241 | } |
| 242 | |
| 243 | table DepthToSpaceDescriptor { |
| 244 | blockSize:uint; |
| 245 | dataLayout:DataLayout; |
| 246 | } |
| 247 | |
Éanna Ó Catháin | 5888589 | 2019-02-27 16:16:39 +0000 | [diff] [blame] | 248 | table DivisionLayer { |
| 249 | base:LayerBase; |
| 250 | } |
| 251 | |
Aron Virginas-Tar | e80ebd1 | 2019-10-17 16:11:54 +0100 | [diff] [blame^] | 252 | /// @deprecated Use ComparisonLayer instead |
Nattapat Chaimanowong | 235cea5 | 2019-02-28 16:27:30 +0000 | [diff] [blame] | 253 | table EqualLayer { |
| 254 | base:LayerBase; |
| 255 | } |
| 256 | |
Finn Williams | dd2ba7e | 2019-03-01 11:51:52 +0000 | [diff] [blame] | 257 | table FloorLayer{ |
| 258 | base:LayerBase; |
| 259 | } |
| 260 | |
Sadik Armagan | dbb0c0c | 2019-02-21 09:01:41 +0000 | [diff] [blame] | 261 | table FullyConnectedLayer { |
| 262 | base:LayerBase; |
| 263 | descriptor:FullyConnectedDescriptor; |
| 264 | weights:ConstTensor; |
| 265 | biases:ConstTensor; |
| 266 | } |
| 267 | |
| 268 | table FullyConnectedDescriptor { |
| 269 | biasEnabled:bool = false; |
| 270 | transposeWeightsMatrix:bool = false; |
| 271 | } |
| 272 | |
Saoirse Stewart | a1ed73a | 2019-03-04 13:40:12 +0000 | [diff] [blame] | 273 | table GatherLayer { |
| 274 | base:LayerBase; |
| 275 | } |
| 276 | |
Aron Virginas-Tar | e80ebd1 | 2019-10-17 16:11:54 +0100 | [diff] [blame^] | 277 | /// @deprecated Use ComparisonLayer instead |
Conor Kennedy | 79ffdf5 | 2019-03-01 14:24:54 +0000 | [diff] [blame] | 278 | table GreaterLayer { |
| 279 | base:LayerBase; |
| 280 | } |
| 281 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 282 | table InputLayer { |
| 283 | base:BindableLayerBase; |
| 284 | } |
| 285 | |
Aron Virginas-Tar | 781ced9 | 2019-10-03 11:15:39 +0100 | [diff] [blame] | 286 | table InstanceNormalizationLayer { |
| 287 | base:LayerBase; |
| 288 | descriptor:InstanceNormalizationDescriptor; |
| 289 | } |
| 290 | |
| 291 | table InstanceNormalizationDescriptor { |
| 292 | gamma:float; |
| 293 | beta:float; |
| 294 | eps:float; |
| 295 | dataLayout:DataLayout; |
| 296 | } |
| 297 | |
Sadik Armagan | 2625785 | 2019-10-14 13:00:47 +0100 | [diff] [blame] | 298 | table LogSoftmaxLayer { |
| 299 | base:LayerBase; |
| 300 | descriptor:LogSoftmaxDescriptor; |
| 301 | } |
| 302 | |
| 303 | table LogSoftmaxDescriptor { |
| 304 | beta:float = 1; |
| 305 | axis:int = -1; |
| 306 | } |
| 307 | |
Narumol Prangnawarat | 495701f | 2019-03-07 17:31:34 +0000 | [diff] [blame] | 308 | table L2NormalizationLayer { |
| 309 | base:LayerBase; |
| 310 | descriptor:L2NormalizationDescriptor; |
| 311 | } |
| 312 | |
| 313 | table L2NormalizationDescriptor { |
| 314 | dataLayout:DataLayout = NCHW; |
Ferran Balaguer | 0dcffec | 2019-06-18 16:25:06 +0100 | [diff] [blame] | 315 | eps:float = 1e-12; |
Narumol Prangnawarat | 495701f | 2019-03-07 17:31:34 +0000 | [diff] [blame] | 316 | } |
| 317 | |
Aron Virginas-Tar | 0fe3245 | 2019-02-28 13:12:47 +0000 | [diff] [blame] | 318 | table MinimumLayer { |
| 319 | base:LayerBase; |
| 320 | } |
| 321 | |
Aron Virginas-Tar | 377351e | 2019-02-27 14:42:31 +0000 | [diff] [blame] | 322 | table MaximumLayer { |
| 323 | base:LayerBase; |
| 324 | } |
| 325 | |
Sadik Armagan | 5f45027 | 2019-02-12 14:31:45 +0000 | [diff] [blame] | 326 | table MultiplicationLayer { |
| 327 | base:LayerBase; |
| 328 | } |
| 329 | |
Saoirse Stewart | 3166c3e | 2019-02-18 15:24:53 +0000 | [diff] [blame] | 330 | table Pooling2dLayer { |
| 331 | base:LayerBase; |
| 332 | descriptor:Pooling2dDescriptor; |
| 333 | } |
| 334 | |
| 335 | enum PoolingAlgorithm : byte { |
| 336 | Max = 0, |
| 337 | Average = 1, |
| 338 | L2 = 2 |
| 339 | } |
| 340 | |
| 341 | enum OutputShapeRounding : byte { |
| 342 | Floor = 0, |
| 343 | Ceiling = 1 |
| 344 | } |
| 345 | |
| 346 | enum PaddingMethod : byte { |
| 347 | IgnoreValue = 0, |
| 348 | Exclude = 1 |
| 349 | } |
| 350 | |
| 351 | table Pooling2dDescriptor { |
| 352 | poolType:PoolingAlgorithm; |
| 353 | padLeft:uint; |
| 354 | padRight:uint; |
| 355 | padTop:uint; |
| 356 | padBottom:uint; |
| 357 | poolWidth:uint; |
| 358 | poolHeight:uint; |
| 359 | strideX:uint; |
| 360 | strideY:uint; |
| 361 | outputShapeRounding:OutputShapeRounding; |
| 362 | paddingMethod:PaddingMethod; |
| 363 | dataLayout:DataLayout; |
| 364 | } |
| 365 | |
Derek Lamberti | 87acb27 | 2019-03-27 16:51:31 +0000 | [diff] [blame] | 366 | table QuantizeLayer { |
| 367 | base:LayerBase; |
| 368 | } |
| 369 | |
Aron Virginas-Tar | fc413c0 | 2019-02-13 15:41:52 +0000 | [diff] [blame] | 370 | table SoftmaxLayer { |
| 371 | base:LayerBase; |
| 372 | descriptor:SoftmaxDescriptor; |
| 373 | } |
| 374 | |
| 375 | table SoftmaxDescriptor { |
| 376 | beta:float; |
| 377 | } |
| 378 | |
Aron Virginas-Tar | c04125f | 2019-02-19 16:31:08 +0000 | [diff] [blame] | 379 | table DepthwiseConvolution2dLayer { |
| 380 | base:LayerBase; |
| 381 | descriptor:DepthwiseConvolution2dDescriptor; |
| 382 | weights:ConstTensor; |
| 383 | biases:ConstTensor; |
| 384 | } |
| 385 | |
| 386 | table DepthwiseConvolution2dDescriptor { |
| 387 | padLeft:uint; |
| 388 | padRight:uint; |
| 389 | padTop:uint; |
| 390 | padBottom:uint; |
| 391 | strideX:uint; |
| 392 | strideY:uint; |
Matthew Bentham | acad04e | 2019-05-13 10:02:45 +0100 | [diff] [blame] | 393 | dilationX:uint = 1; |
| 394 | dilationY:uint = 1; |
Aron Virginas-Tar | c04125f | 2019-02-19 16:31:08 +0000 | [diff] [blame] | 395 | biasEnabled:bool = false; |
| 396 | dataLayout:DataLayout = NCHW; |
| 397 | } |
| 398 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 399 | table OutputLayer { |
| 400 | base:BindableLayerBase; |
| 401 | } |
| 402 | |
Saoirse Stewart | 263829c | 2019-02-19 15:54:14 +0000 | [diff] [blame] | 403 | table ReshapeLayer { |
| 404 | base:LayerBase; |
| 405 | descriptor:ReshapeDescriptor; |
| 406 | } |
| 407 | |
| 408 | table ReshapeDescriptor { |
| 409 | targetShape:[uint]; |
| 410 | } |
| 411 | |
Nattapat Chaimanowong | 30b0020 | 2019-02-20 17:31:34 +0000 | [diff] [blame] | 412 | table PermuteLayer { |
| 413 | base:LayerBase; |
| 414 | descriptor:PermuteDescriptor; |
| 415 | } |
| 416 | |
| 417 | table PermuteDescriptor { |
| 418 | dimMappings:[uint]; |
| 419 | } |
| 420 | |
Nattapat Chaimanowong | 4528699 | 2019-02-26 15:53:02 +0000 | [diff] [blame] | 421 | table SpaceToBatchNdLayer { |
| 422 | base:LayerBase; |
| 423 | descriptor:SpaceToBatchNdDescriptor; |
| 424 | } |
| 425 | |
| 426 | table SpaceToBatchNdDescriptor { |
| 427 | blockShape:[uint]; |
| 428 | padList:[uint]; |
| 429 | dataLayout:DataLayout; |
| 430 | } |
| 431 | |
Aron Virginas-Tar | aa06714 | 2019-06-11 16:01:44 +0100 | [diff] [blame] | 432 | table SpaceToDepthLayer { |
| 433 | base:LayerBase; |
| 434 | descriptor:SpaceToDepthDescriptor; |
| 435 | } |
| 436 | |
| 437 | table SpaceToDepthDescriptor { |
| 438 | blockSize:uint; |
| 439 | dataLayout:DataLayout; |
| 440 | } |
| 441 | |
Conor Kennedy | da1f975 | 2019-03-01 14:37:12 +0000 | [diff] [blame] | 442 | table SubtractionLayer { |
| 443 | base:LayerBase; |
| 444 | } |
| 445 | |
Nattapat Chaimanowong | 6b4ed98 | 2019-02-26 17:24:13 +0000 | [diff] [blame] | 446 | table BatchToSpaceNdLayer { |
| 447 | base:LayerBase; |
| 448 | descriptor:BatchToSpaceNdDescriptor; |
| 449 | } |
| 450 | |
| 451 | table BatchToSpaceNdDescriptor { |
| 452 | blockShape:[uint]; |
| 453 | crops:[uint]; |
| 454 | dataLayout:DataLayout; |
| 455 | } |
| 456 | |
Nina Drozd | 5772878 | 2019-02-27 10:53:27 +0000 | [diff] [blame] | 457 | enum NormalizationAlgorithmChannel : byte { |
| 458 | Across = 0, |
| 459 | Within = 1 |
| 460 | } |
| 461 | |
| 462 | enum NormalizationAlgorithmMethod : byte { |
| 463 | LocalBrightness = 0, |
| 464 | LocalContrast = 1 |
| 465 | } |
| 466 | |
| 467 | table NormalizationLayer { |
| 468 | base:LayerBase; |
| 469 | descriptor:NormalizationDescriptor; |
| 470 | } |
| 471 | |
| 472 | table NormalizationDescriptor { |
| 473 | normChannelType:NormalizationAlgorithmChannel = Across; |
| 474 | normMethodType:NormalizationAlgorithmMethod = LocalBrightness; |
| 475 | normSize:uint; |
| 476 | alpha:float; |
| 477 | beta:float; |
| 478 | k:float; |
| 479 | dataLayout:DataLayout = NCHW; |
| 480 | } |
| 481 | |
Sadik Armagan | ac97c8c | 2019-03-04 17:44:21 +0000 | [diff] [blame] | 482 | table MeanLayer { |
| 483 | base:LayerBase; |
| 484 | descriptor:MeanDescriptor; |
| 485 | } |
| 486 | |
| 487 | table MeanDescriptor { |
| 488 | axis:[uint]; |
| 489 | keepDims:bool = false; |
| 490 | } |
| 491 | |
Nattapat Chaimanowong | ebb0f9c | 2019-03-01 12:14:06 +0000 | [diff] [blame] | 492 | table PadLayer { |
| 493 | base:LayerBase; |
| 494 | descriptor:PadDescriptor; |
| 495 | } |
| 496 | |
| 497 | table PadDescriptor { |
| 498 | padList:[uint]; |
David Monahan | 3475781 | 2019-06-19 11:47:21 +0100 | [diff] [blame] | 499 | padValue:float = 0; |
Nattapat Chaimanowong | ebb0f9c | 2019-03-01 12:14:06 +0000 | [diff] [blame] | 500 | } |
| 501 | |
Sadik Armagan | 8b42a38 | 2019-03-01 14:24:49 +0000 | [diff] [blame] | 502 | table RsqrtLayer { |
| 503 | base:LayerBase; |
| 504 | } |
| 505 | |
ruoyan01 | 8e7fa23 | 2019-02-28 15:09:07 +0000 | [diff] [blame] | 506 | table BatchNormalizationLayer { |
| 507 | base:LayerBase; |
| 508 | descriptor:BatchNormalizationDescriptor; |
| 509 | mean:ConstTensor; |
| 510 | variance:ConstTensor; |
| 511 | beta:ConstTensor; |
| 512 | gamma:ConstTensor; |
| 513 | } |
| 514 | |
| 515 | table BatchNormalizationDescriptor { |
| 516 | eps:float; |
| 517 | dataLayout:DataLayout; |
| 518 | } |
| 519 | |
Aron Virginas-Tar | e80ebd1 | 2019-10-17 16:11:54 +0100 | [diff] [blame^] | 520 | /// @deprecated Use ResizeLayer instead |
Nattapat Chaimanowong | 6522cdc | 2019-03-01 16:14:13 +0000 | [diff] [blame] | 521 | table ResizeBilinearLayer { |
| 522 | base:LayerBase; |
| 523 | descriptor:ResizeBilinearDescriptor; |
| 524 | } |
| 525 | |
| 526 | table ResizeBilinearDescriptor { |
| 527 | targetWidth:uint; |
| 528 | targetHeight:uint; |
| 529 | dataLayout:DataLayout; |
| 530 | } |
| 531 | |
Aron Virginas-Tar | 2fda80b | 2019-09-18 13:36:52 +0100 | [diff] [blame] | 532 | table SliceLayer { |
| 533 | base:LayerBase; |
| 534 | descriptor:SliceDescriptor; |
| 535 | } |
| 536 | |
| 537 | table SliceDescriptor { |
| 538 | begin:[uint]; |
| 539 | size:[uint]; |
| 540 | } |
| 541 | |
Nattapat Chaimanowong | b348521 | 2019-03-04 12:35:39 +0000 | [diff] [blame] | 542 | table StridedSliceLayer { |
| 543 | base:LayerBase; |
| 544 | descriptor:StridedSliceDescriptor; |
| 545 | } |
| 546 | |
| 547 | table StridedSliceDescriptor { |
| 548 | begin:[int]; |
| 549 | end:[int]; |
| 550 | stride:[int]; |
| 551 | beginMask:int; |
| 552 | endMask:int; |
| 553 | shrinkAxisMask:int; |
| 554 | ellipsisMask:int; |
| 555 | newAxisMask:int; |
| 556 | dataLayout:DataLayout; |
| 557 | } |
| 558 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 559 | table ConcatLayer { |
| 560 | base:LayerBase; |
| 561 | descriptor:OriginsDescriptor; |
| 562 | } |
| 563 | |
Aron Virginas-Tar | e80ebd1 | 2019-10-17 16:11:54 +0100 | [diff] [blame^] | 564 | /// @deprecated Use ConcatLayer instead |
Jim Flynn | ac25a1b | 2019-02-28 10:40:49 +0000 | [diff] [blame] | 565 | table MergerLayer { |
| 566 | base:LayerBase; |
| 567 | descriptor:OriginsDescriptor; |
| 568 | } |
| 569 | |
| 570 | table UintVector { |
| 571 | data:[uint]; |
| 572 | } |
| 573 | |
| 574 | table OriginsDescriptor { |
| 575 | concatAxis:uint; |
| 576 | numViews:uint; |
| 577 | numDimensions:uint; |
| 578 | viewOrigins:[UintVector]; |
| 579 | } |
| 580 | |
Jim Flynn | 18ce338 | 2019-03-08 11:08:30 +0000 | [diff] [blame] | 581 | table ViewsDescriptor { |
| 582 | origins:OriginsDescriptor; |
| 583 | viewSizes:[UintVector]; |
| 584 | } |
| 585 | |
| 586 | table SplitterLayer { |
| 587 | base:LayerBase; |
| 588 | descriptor:ViewsDescriptor; |
| 589 | } |
| 590 | |
Nattapat Chaimanowong | 3e14a9d | 2019-03-18 12:37:06 +0000 | [diff] [blame] | 591 | table DetectionPostProcessLayer { |
| 592 | base:LayerBase; |
| 593 | descriptor:DetectionPostProcessDescriptor; |
| 594 | anchors:ConstTensor; |
| 595 | } |
| 596 | |
| 597 | table DetectionPostProcessDescriptor { |
| 598 | maxDetections:uint; |
| 599 | maxClassesPerDetection:uint; |
| 600 | detectionsPerClass:uint; |
| 601 | nmsScoreThreshold:float; |
| 602 | nmsIouThreshold:float; |
| 603 | numClasses:uint; |
| 604 | useRegularNms:bool; |
| 605 | scaleX:float; |
| 606 | scaleY:float; |
| 607 | scaleW:float; |
| 608 | scaleH:float; |
| 609 | } |
| 610 | |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 611 | table LstmInputParams { |
| 612 | inputToForgetWeights:ConstTensor; |
| 613 | inputToCellWeights:ConstTensor; |
| 614 | inputToOutputWeights:ConstTensor; |
| 615 | recurrentToForgetWeights:ConstTensor; |
| 616 | recurrentToCellWeights:ConstTensor; |
| 617 | recurrentToOutputWeights:ConstTensor; |
| 618 | forgetGateBias:ConstTensor; |
| 619 | cellBias:ConstTensor; |
| 620 | outputGateBias:ConstTensor; |
| 621 | |
| 622 | inputToInputWeights:ConstTensor; |
| 623 | recurrentToInputWeights:ConstTensor; |
| 624 | cellToInputWeights:ConstTensor; |
| 625 | inputGateBias:ConstTensor; |
| 626 | |
| 627 | projectionWeights:ConstTensor; |
| 628 | projectionBias:ConstTensor; |
| 629 | |
| 630 | cellToForgetWeights:ConstTensor; |
| 631 | cellToOutputWeights:ConstTensor; |
Jan Eilers | f8c6297 | 2019-07-17 11:07:49 +0100 | [diff] [blame] | 632 | |
| 633 | inputLayerNormWeights:ConstTensor; |
| 634 | forgetLayerNormWeights:ConstTensor; |
| 635 | cellLayerNormWeights:ConstTensor; |
| 636 | outputLayerNormWeights:ConstTensor; |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 637 | } |
| 638 | |
Jan Eilers | 5b01a89 | 2019-07-23 09:47:43 +0100 | [diff] [blame] | 639 | table QuantizedLstmInputParams { |
| 640 | inputToInputWeights:ConstTensor; |
| 641 | inputToForgetWeights:ConstTensor; |
| 642 | inputToCellWeights:ConstTensor; |
| 643 | inputToOutputWeights:ConstTensor; |
| 644 | |
| 645 | recurrentToInputWeights:ConstTensor; |
| 646 | recurrentToForgetWeights:ConstTensor; |
| 647 | recurrentToCellWeights:ConstTensor; |
| 648 | recurrentToOutputWeights:ConstTensor; |
| 649 | |
| 650 | inputGateBias:ConstTensor; |
| 651 | forgetGateBias:ConstTensor; |
| 652 | cellBias:ConstTensor; |
| 653 | outputGateBias:ConstTensor; |
| 654 | } |
| 655 | |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 656 | table LstmDescriptor { |
| 657 | activationFunc:uint; |
| 658 | clippingThresCell:float; |
| 659 | clippingThresProj:float; |
| 660 | cifgEnabled:bool = true; |
| 661 | peepholeEnabled:bool = false; |
| 662 | projectionEnabled:bool = false; |
Jan Eilers | f8c6297 | 2019-07-17 11:07:49 +0100 | [diff] [blame] | 663 | layerNormEnabled:bool = false; |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 664 | } |
| 665 | |
| 666 | table LstmLayer { |
| 667 | base:LayerBase; |
| 668 | descriptor:LstmDescriptor; |
| 669 | inputParams:LstmInputParams; |
| 670 | } |
| 671 | |
Jan Eilers | 5b01a89 | 2019-07-23 09:47:43 +0100 | [diff] [blame] | 672 | table QuantizedLstmLayer { |
| 673 | base:LayerBase; |
| 674 | inputParams:QuantizedLstmInputParams; |
| 675 | } |
| 676 | |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 677 | table DequantizeLayer { |
| 678 | base:LayerBase; |
| 679 | } |
| 680 | |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 681 | table MergeLayer { |
| 682 | base:LayerBase; |
| 683 | } |
| 684 | |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 685 | table SwitchLayer { |
| 686 | base:LayerBase; |
| 687 | } |
| 688 | |
Ellen Norris-Thompson | 5198247 | 2019-06-19 11:46:21 +0100 | [diff] [blame] | 689 | table PreluLayer { |
| 690 | base:LayerBase; |
| 691 | } |
| 692 | |
Aron Virginas-Tar | cb54930 | 2019-06-21 13:53:38 +0100 | [diff] [blame] | 693 | table TransposeConvolution2dLayer { |
| 694 | base:LayerBase; |
| 695 | descriptor:TransposeConvolution2dDescriptor; |
| 696 | weights:ConstTensor; |
| 697 | biases:ConstTensor; |
| 698 | } |
| 699 | |
| 700 | table TransposeConvolution2dDescriptor { |
| 701 | padLeft:uint; |
| 702 | padRight:uint; |
| 703 | padTop:uint; |
| 704 | padBottom:uint; |
| 705 | strideX:uint; |
| 706 | strideY:uint; |
| 707 | biasEnabled:bool = false; |
| 708 | dataLayout:DataLayout = NCHW; |
| 709 | } |
| 710 | |
FinnWilliamsArm | 6fb339a | 2019-06-28 15:07:10 +0100 | [diff] [blame] | 711 | table ResizeLayer { |
| 712 | base:LayerBase; |
| 713 | descriptor:ResizeDescriptor; |
| 714 | } |
| 715 | |
| 716 | table ResizeDescriptor { |
| 717 | targetHeight:uint; |
| 718 | targetWidth:uint; |
| 719 | method:ResizeMethod = NearestNeighbor; |
| 720 | dataLayout:DataLayout; |
| 721 | } |
| 722 | |
Matthew Jackson | b5433ee | 2019-07-11 15:54:20 +0100 | [diff] [blame] | 723 | table StackLayer { |
| 724 | base:LayerBase; |
| 725 | descriptor:StackDescriptor; |
| 726 | } |
| 727 | |
| 728 | table StackDescriptor { |
| 729 | axis:uint; |
| 730 | numInputs:uint; |
| 731 | inputShape:[uint]; |
| 732 | } |
| 733 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 734 | union Layer { |
Mike Kelly | af48401 | 2019-02-20 16:53:11 +0000 | [diff] [blame] | 735 | ActivationLayer, |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 736 | AdditionLayer, |
Nattapat Chaimanowong | 6b4ed98 | 2019-02-26 17:24:13 +0000 | [diff] [blame] | 737 | BatchToSpaceNdLayer, |
ruoyan01 | 8e7fa23 | 2019-02-28 15:09:07 +0000 | [diff] [blame] | 738 | BatchNormalizationLayer, |
Conor Kennedy | 7627788 | 2019-02-26 08:29:54 +0000 | [diff] [blame] | 739 | ConstantLayer, |
Mike Kelly | a0766c3 | 2019-02-19 17:22:07 +0000 | [diff] [blame] | 740 | Convolution2dLayer, |
Aron Virginas-Tar | c04125f | 2019-02-19 16:31:08 +0000 | [diff] [blame] | 741 | DepthwiseConvolution2dLayer, |
Sadik Armagan | dbb0c0c | 2019-02-21 09:01:41 +0000 | [diff] [blame] | 742 | FullyConnectedLayer, |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 743 | InputLayer, |
Sadik Armagan | 5f45027 | 2019-02-12 14:31:45 +0000 | [diff] [blame] | 744 | MultiplicationLayer, |
Aron Virginas-Tar | fc413c0 | 2019-02-13 15:41:52 +0000 | [diff] [blame] | 745 | OutputLayer, |
Nattapat Chaimanowong | 30b0020 | 2019-02-20 17:31:34 +0000 | [diff] [blame] | 746 | PermuteLayer, |
Saoirse Stewart | 3166c3e | 2019-02-18 15:24:53 +0000 | [diff] [blame] | 747 | Pooling2dLayer, |
Saoirse Stewart | 263829c | 2019-02-19 15:54:14 +0000 | [diff] [blame] | 748 | ReshapeLayer, |
Nattapat Chaimanowong | 4528699 | 2019-02-26 15:53:02 +0000 | [diff] [blame] | 749 | SoftmaxLayer, |
Éanna Ó Catháin | 5888589 | 2019-02-27 16:16:39 +0000 | [diff] [blame] | 750 | SpaceToBatchNdLayer, |
Aron Virginas-Tar | 0fe3245 | 2019-02-28 13:12:47 +0000 | [diff] [blame] | 751 | DivisionLayer, |
Nattapat Chaimanowong | 235cea5 | 2019-02-28 16:27:30 +0000 | [diff] [blame] | 752 | MinimumLayer, |
Aron Virginas-Tar | 377351e | 2019-02-27 14:42:31 +0000 | [diff] [blame] | 753 | EqualLayer, |
Nina Drozd | 5772878 | 2019-02-27 10:53:27 +0000 | [diff] [blame] | 754 | MaximumLayer, |
Nattapat Chaimanowong | ebb0f9c | 2019-03-01 12:14:06 +0000 | [diff] [blame] | 755 | NormalizationLayer, |
Sadik Armagan | 8b42a38 | 2019-03-01 14:24:49 +0000 | [diff] [blame] | 756 | PadLayer, |
Finn Williams | dd2ba7e | 2019-03-01 11:51:52 +0000 | [diff] [blame] | 757 | RsqrtLayer, |
Conor Kennedy | 79ffdf5 | 2019-03-01 14:24:54 +0000 | [diff] [blame] | 758 | FloorLayer, |
Nattapat Chaimanowong | 6522cdc | 2019-03-01 16:14:13 +0000 | [diff] [blame] | 759 | GreaterLayer, |
Conor Kennedy | da1f975 | 2019-03-01 14:37:12 +0000 | [diff] [blame] | 760 | ResizeBilinearLayer, |
Nattapat Chaimanowong | b348521 | 2019-03-04 12:35:39 +0000 | [diff] [blame] | 761 | SubtractionLayer, |
Saoirse Stewart | a1ed73a | 2019-03-04 13:40:12 +0000 | [diff] [blame] | 762 | StridedSliceLayer, |
Sadik Armagan | ac97c8c | 2019-03-04 17:44:21 +0000 | [diff] [blame] | 763 | GatherLayer, |
Jim Flynn | ac25a1b | 2019-02-28 10:40:49 +0000 | [diff] [blame] | 764 | MeanLayer, |
Narumol Prangnawarat | 495701f | 2019-03-07 17:31:34 +0000 | [diff] [blame] | 765 | MergerLayer, |
Jim Flynn | 18ce338 | 2019-03-08 11:08:30 +0000 | [diff] [blame] | 766 | L2NormalizationLayer, |
Nattapat Chaimanowong | 3e14a9d | 2019-03-18 12:37:06 +0000 | [diff] [blame] | 767 | SplitterLayer, |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 768 | DetectionPostProcessLayer, |
Derek Lamberti | 87acb27 | 2019-03-27 16:51:31 +0000 | [diff] [blame] | 769 | LstmLayer, |
Jan Eilers | 5b01a89 | 2019-07-23 09:47:43 +0100 | [diff] [blame] | 770 | QuantizedLstmLayer, |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 771 | QuantizeLayer, |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 772 | DequantizeLayer, |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 773 | MergeLayer, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 774 | SwitchLayer, |
Aron Virginas-Tar | aa06714 | 2019-06-11 16:01:44 +0100 | [diff] [blame] | 775 | ConcatLayer, |
Ellen Norris-Thompson | 5198247 | 2019-06-19 11:46:21 +0100 | [diff] [blame] | 776 | SpaceToDepthLayer, |
Aron Virginas-Tar | cb54930 | 2019-06-21 13:53:38 +0100 | [diff] [blame] | 777 | PreluLayer, |
FinnWilliamsArm | 6fb339a | 2019-06-28 15:07:10 +0100 | [diff] [blame] | 778 | TransposeConvolution2dLayer, |
Matthew Jackson | b5433ee | 2019-07-11 15:54:20 +0100 | [diff] [blame] | 779 | ResizeLayer, |
FinnWilliamsArm | 4ffcc8f | 2019-09-05 14:34:20 +0100 | [diff] [blame] | 780 | StackLayer, |
Narumol Prangnawarat | 0cfcf23 | 2019-09-09 17:16:24 +0100 | [diff] [blame] | 781 | AbsLayer, |
Aron Virginas-Tar | 2fda80b | 2019-09-18 13:36:52 +0100 | [diff] [blame] | 782 | ArgMinMaxLayer, |
Aron Virginas-Tar | da9d2d3 | 2019-09-20 10:42:02 +0100 | [diff] [blame] | 783 | SliceLayer, |
Aron Virginas-Tar | 781ced9 | 2019-10-03 11:15:39 +0100 | [diff] [blame] | 784 | DepthToSpaceLayer, |
Sadik Armagan | 2625785 | 2019-10-14 13:00:47 +0100 | [diff] [blame] | 785 | InstanceNormalizationLayer, |
Aron Virginas-Tar | e80ebd1 | 2019-10-17 16:11:54 +0100 | [diff] [blame^] | 786 | LogSoftmaxLayer, |
| 787 | ComparisonLayer |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 788 | } |
| 789 | |
Saoirse Stewart | 49dbe0e | 2019-02-05 17:27:06 +0000 | [diff] [blame] | 790 | table AnyLayer { |
| 791 | layer:Layer; |
| 792 | } |
| 793 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 794 | // Root type for serialized data is the graph of the network |
| 795 | table SerializedGraph { |
Saoirse Stewart | 49dbe0e | 2019-02-05 17:27:06 +0000 | [diff] [blame] | 796 | layers:[AnyLayer]; |
Mike Kelly | 8c1701a | 2019-02-11 17:01:27 +0000 | [diff] [blame] | 797 | inputIds:[uint]; |
| 798 | outputIds:[uint]; |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 799 | } |
| 800 | |
| 801 | root_type SerializedGraph; |