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, |
| 144 | DepthToSpace = 49 |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | // Base layer table to be used as part of other layers |
| 148 | table LayerBase { |
| 149 | index:uint; |
| 150 | layerName:string; |
| 151 | layerType:LayerType; |
| 152 | inputSlots:[InputSlot]; |
| 153 | outputSlots:[OutputSlot]; |
| 154 | } |
| 155 | |
| 156 | table BindableLayerBase { |
| 157 | base:LayerBase; |
| 158 | layerBindingId:int; |
| 159 | } |
| 160 | |
| 161 | // Table for each layer defined below |
FinnWilliamsArm | 4ffcc8f | 2019-09-05 14:34:20 +0100 | [diff] [blame] | 162 | |
| 163 | table AbsLayer { |
| 164 | base:LayerBase; |
| 165 | } |
| 166 | |
Mike Kelly | af48401 | 2019-02-20 16:53:11 +0000 | [diff] [blame] | 167 | table ActivationLayer { |
| 168 | base:LayerBase; |
| 169 | descriptor:ActivationDescriptor; |
| 170 | } |
| 171 | |
| 172 | table ActivationDescriptor { |
| 173 | function:ActivationFunction = Sigmoid; |
| 174 | a:float; |
| 175 | b:float; |
| 176 | } |
| 177 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 178 | table AdditionLayer { |
| 179 | base:LayerBase; |
| 180 | } |
| 181 | |
Narumol Prangnawarat | 0cfcf23 | 2019-09-09 17:16:24 +0100 | [diff] [blame] | 182 | table ArgMinMaxLayer { |
| 183 | base:LayerBase; |
| 184 | descriptor:ArgMinMaxDescriptor; |
| 185 | } |
| 186 | |
| 187 | table ArgMinMaxDescriptor{ |
| 188 | function:ArgMinMaxFunction; |
| 189 | axis:int; |
| 190 | } |
| 191 | |
Conor Kennedy | 7627788 | 2019-02-26 08:29:54 +0000 | [diff] [blame] | 192 | table ConstantLayer { |
| 193 | base:LayerBase; |
| 194 | input:ConstTensor; |
| 195 | } |
| 196 | |
Mike Kelly | a0766c3 | 2019-02-19 17:22:07 +0000 | [diff] [blame] | 197 | table Convolution2dLayer { |
| 198 | base:LayerBase; |
| 199 | descriptor:Convolution2dDescriptor; |
| 200 | weights:ConstTensor; |
| 201 | biases:ConstTensor; |
| 202 | } |
| 203 | |
| 204 | table Convolution2dDescriptor { |
| 205 | padLeft:uint; |
| 206 | padRight:uint; |
| 207 | padTop:uint; |
| 208 | padBottom:uint; |
| 209 | strideX:uint; |
| 210 | strideY:uint; |
Matthew Bentham | acad04e | 2019-05-13 10:02:45 +0100 | [diff] [blame] | 211 | dilationX:uint = 1; |
| 212 | dilationY:uint = 1; |
Mike Kelly | a0766c3 | 2019-02-19 17:22:07 +0000 | [diff] [blame] | 213 | biasEnabled:bool = false; |
| 214 | dataLayout:DataLayout = NCHW; |
| 215 | } |
| 216 | |
Aron Virginas-Tar | da9d2d3 | 2019-09-20 10:42:02 +0100 | [diff] [blame] | 217 | table DepthToSpaceLayer { |
| 218 | base:LayerBase; |
| 219 | descriptor:DepthToSpaceDescriptor; |
| 220 | } |
| 221 | |
| 222 | table DepthToSpaceDescriptor { |
| 223 | blockSize:uint; |
| 224 | dataLayout:DataLayout; |
| 225 | } |
| 226 | |
Éanna Ó Catháin | 5888589 | 2019-02-27 16:16:39 +0000 | [diff] [blame] | 227 | table DivisionLayer { |
| 228 | base:LayerBase; |
| 229 | } |
| 230 | |
Nattapat Chaimanowong | 235cea5 | 2019-02-28 16:27:30 +0000 | [diff] [blame] | 231 | table EqualLayer { |
| 232 | base:LayerBase; |
| 233 | } |
| 234 | |
Finn Williams | dd2ba7e | 2019-03-01 11:51:52 +0000 | [diff] [blame] | 235 | table FloorLayer{ |
| 236 | base:LayerBase; |
| 237 | } |
| 238 | |
Sadik Armagan | dbb0c0c | 2019-02-21 09:01:41 +0000 | [diff] [blame] | 239 | table FullyConnectedLayer { |
| 240 | base:LayerBase; |
| 241 | descriptor:FullyConnectedDescriptor; |
| 242 | weights:ConstTensor; |
| 243 | biases:ConstTensor; |
| 244 | } |
| 245 | |
| 246 | table FullyConnectedDescriptor { |
| 247 | biasEnabled:bool = false; |
| 248 | transposeWeightsMatrix:bool = false; |
| 249 | } |
| 250 | |
Saoirse Stewart | a1ed73a | 2019-03-04 13:40:12 +0000 | [diff] [blame] | 251 | table GatherLayer { |
| 252 | base:LayerBase; |
| 253 | } |
| 254 | |
Conor Kennedy | 79ffdf5 | 2019-03-01 14:24:54 +0000 | [diff] [blame] | 255 | table GreaterLayer { |
| 256 | base:LayerBase; |
| 257 | } |
| 258 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 259 | table InputLayer { |
| 260 | base:BindableLayerBase; |
| 261 | } |
| 262 | |
Narumol Prangnawarat | 495701f | 2019-03-07 17:31:34 +0000 | [diff] [blame] | 263 | table L2NormalizationLayer { |
| 264 | base:LayerBase; |
| 265 | descriptor:L2NormalizationDescriptor; |
| 266 | } |
| 267 | |
| 268 | table L2NormalizationDescriptor { |
| 269 | dataLayout:DataLayout = NCHW; |
Ferran Balaguer | 0dcffec | 2019-06-18 16:25:06 +0100 | [diff] [blame] | 270 | eps:float = 1e-12; |
Narumol Prangnawarat | 495701f | 2019-03-07 17:31:34 +0000 | [diff] [blame] | 271 | } |
| 272 | |
Aron Virginas-Tar | 0fe3245 | 2019-02-28 13:12:47 +0000 | [diff] [blame] | 273 | table MinimumLayer { |
| 274 | base:LayerBase; |
| 275 | } |
| 276 | |
Aron Virginas-Tar | 377351e | 2019-02-27 14:42:31 +0000 | [diff] [blame] | 277 | table MaximumLayer { |
| 278 | base:LayerBase; |
| 279 | } |
| 280 | |
Sadik Armagan | 5f45027 | 2019-02-12 14:31:45 +0000 | [diff] [blame] | 281 | table MultiplicationLayer { |
| 282 | base:LayerBase; |
| 283 | } |
| 284 | |
Saoirse Stewart | 3166c3e | 2019-02-18 15:24:53 +0000 | [diff] [blame] | 285 | table Pooling2dLayer { |
| 286 | base:LayerBase; |
| 287 | descriptor:Pooling2dDescriptor; |
| 288 | } |
| 289 | |
| 290 | enum PoolingAlgorithm : byte { |
| 291 | Max = 0, |
| 292 | Average = 1, |
| 293 | L2 = 2 |
| 294 | } |
| 295 | |
| 296 | enum OutputShapeRounding : byte { |
| 297 | Floor = 0, |
| 298 | Ceiling = 1 |
| 299 | } |
| 300 | |
| 301 | enum PaddingMethod : byte { |
| 302 | IgnoreValue = 0, |
| 303 | Exclude = 1 |
| 304 | } |
| 305 | |
| 306 | table Pooling2dDescriptor { |
| 307 | poolType:PoolingAlgorithm; |
| 308 | padLeft:uint; |
| 309 | padRight:uint; |
| 310 | padTop:uint; |
| 311 | padBottom:uint; |
| 312 | poolWidth:uint; |
| 313 | poolHeight:uint; |
| 314 | strideX:uint; |
| 315 | strideY:uint; |
| 316 | outputShapeRounding:OutputShapeRounding; |
| 317 | paddingMethod:PaddingMethod; |
| 318 | dataLayout:DataLayout; |
| 319 | } |
| 320 | |
Derek Lamberti | 87acb27 | 2019-03-27 16:51:31 +0000 | [diff] [blame] | 321 | table QuantizeLayer { |
| 322 | base:LayerBase; |
| 323 | } |
| 324 | |
Aron Virginas-Tar | fc413c0 | 2019-02-13 15:41:52 +0000 | [diff] [blame] | 325 | table SoftmaxLayer { |
| 326 | base:LayerBase; |
| 327 | descriptor:SoftmaxDescriptor; |
| 328 | } |
| 329 | |
| 330 | table SoftmaxDescriptor { |
| 331 | beta:float; |
| 332 | } |
| 333 | |
Aron Virginas-Tar | c04125f | 2019-02-19 16:31:08 +0000 | [diff] [blame] | 334 | table DepthwiseConvolution2dLayer { |
| 335 | base:LayerBase; |
| 336 | descriptor:DepthwiseConvolution2dDescriptor; |
| 337 | weights:ConstTensor; |
| 338 | biases:ConstTensor; |
| 339 | } |
| 340 | |
| 341 | table DepthwiseConvolution2dDescriptor { |
| 342 | padLeft:uint; |
| 343 | padRight:uint; |
| 344 | padTop:uint; |
| 345 | padBottom:uint; |
| 346 | strideX:uint; |
| 347 | strideY:uint; |
Matthew Bentham | acad04e | 2019-05-13 10:02:45 +0100 | [diff] [blame] | 348 | dilationX:uint = 1; |
| 349 | dilationY:uint = 1; |
Aron Virginas-Tar | c04125f | 2019-02-19 16:31:08 +0000 | [diff] [blame] | 350 | biasEnabled:bool = false; |
| 351 | dataLayout:DataLayout = NCHW; |
| 352 | } |
| 353 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 354 | table OutputLayer { |
| 355 | base:BindableLayerBase; |
| 356 | } |
| 357 | |
Saoirse Stewart | 263829c | 2019-02-19 15:54:14 +0000 | [diff] [blame] | 358 | table ReshapeLayer { |
| 359 | base:LayerBase; |
| 360 | descriptor:ReshapeDescriptor; |
| 361 | } |
| 362 | |
| 363 | table ReshapeDescriptor { |
| 364 | targetShape:[uint]; |
| 365 | } |
| 366 | |
Nattapat Chaimanowong | 30b0020 | 2019-02-20 17:31:34 +0000 | [diff] [blame] | 367 | table PermuteLayer { |
| 368 | base:LayerBase; |
| 369 | descriptor:PermuteDescriptor; |
| 370 | } |
| 371 | |
| 372 | table PermuteDescriptor { |
| 373 | dimMappings:[uint]; |
| 374 | } |
| 375 | |
Nattapat Chaimanowong | 4528699 | 2019-02-26 15:53:02 +0000 | [diff] [blame] | 376 | table SpaceToBatchNdLayer { |
| 377 | base:LayerBase; |
| 378 | descriptor:SpaceToBatchNdDescriptor; |
| 379 | } |
| 380 | |
| 381 | table SpaceToBatchNdDescriptor { |
| 382 | blockShape:[uint]; |
| 383 | padList:[uint]; |
| 384 | dataLayout:DataLayout; |
| 385 | } |
| 386 | |
Aron Virginas-Tar | aa06714 | 2019-06-11 16:01:44 +0100 | [diff] [blame] | 387 | table SpaceToDepthLayer { |
| 388 | base:LayerBase; |
| 389 | descriptor:SpaceToDepthDescriptor; |
| 390 | } |
| 391 | |
| 392 | table SpaceToDepthDescriptor { |
| 393 | blockSize:uint; |
| 394 | dataLayout:DataLayout; |
| 395 | } |
| 396 | |
Conor Kennedy | da1f975 | 2019-03-01 14:37:12 +0000 | [diff] [blame] | 397 | table SubtractionLayer { |
| 398 | base:LayerBase; |
| 399 | } |
| 400 | |
Nattapat Chaimanowong | 6b4ed98 | 2019-02-26 17:24:13 +0000 | [diff] [blame] | 401 | table BatchToSpaceNdLayer { |
| 402 | base:LayerBase; |
| 403 | descriptor:BatchToSpaceNdDescriptor; |
| 404 | } |
| 405 | |
| 406 | table BatchToSpaceNdDescriptor { |
| 407 | blockShape:[uint]; |
| 408 | crops:[uint]; |
| 409 | dataLayout:DataLayout; |
| 410 | } |
| 411 | |
Nina Drozd | 5772878 | 2019-02-27 10:53:27 +0000 | [diff] [blame] | 412 | enum NormalizationAlgorithmChannel : byte { |
| 413 | Across = 0, |
| 414 | Within = 1 |
| 415 | } |
| 416 | |
| 417 | enum NormalizationAlgorithmMethod : byte { |
| 418 | LocalBrightness = 0, |
| 419 | LocalContrast = 1 |
| 420 | } |
| 421 | |
| 422 | table NormalizationLayer { |
| 423 | base:LayerBase; |
| 424 | descriptor:NormalizationDescriptor; |
| 425 | } |
| 426 | |
| 427 | table NormalizationDescriptor { |
| 428 | normChannelType:NormalizationAlgorithmChannel = Across; |
| 429 | normMethodType:NormalizationAlgorithmMethod = LocalBrightness; |
| 430 | normSize:uint; |
| 431 | alpha:float; |
| 432 | beta:float; |
| 433 | k:float; |
| 434 | dataLayout:DataLayout = NCHW; |
| 435 | } |
| 436 | |
Sadik Armagan | ac97c8c | 2019-03-04 17:44:21 +0000 | [diff] [blame] | 437 | table MeanLayer { |
| 438 | base:LayerBase; |
| 439 | descriptor:MeanDescriptor; |
| 440 | } |
| 441 | |
| 442 | table MeanDescriptor { |
| 443 | axis:[uint]; |
| 444 | keepDims:bool = false; |
| 445 | } |
| 446 | |
Nattapat Chaimanowong | ebb0f9c | 2019-03-01 12:14:06 +0000 | [diff] [blame] | 447 | table PadLayer { |
| 448 | base:LayerBase; |
| 449 | descriptor:PadDescriptor; |
| 450 | } |
| 451 | |
| 452 | table PadDescriptor { |
| 453 | padList:[uint]; |
David Monahan | 3475781 | 2019-06-19 11:47:21 +0100 | [diff] [blame] | 454 | padValue:float = 0; |
Nattapat Chaimanowong | ebb0f9c | 2019-03-01 12:14:06 +0000 | [diff] [blame] | 455 | } |
| 456 | |
Sadik Armagan | 8b42a38 | 2019-03-01 14:24:49 +0000 | [diff] [blame] | 457 | table RsqrtLayer { |
| 458 | base:LayerBase; |
| 459 | } |
| 460 | |
ruoyan01 | 8e7fa23 | 2019-02-28 15:09:07 +0000 | [diff] [blame] | 461 | table BatchNormalizationLayer { |
| 462 | base:LayerBase; |
| 463 | descriptor:BatchNormalizationDescriptor; |
| 464 | mean:ConstTensor; |
| 465 | variance:ConstTensor; |
| 466 | beta:ConstTensor; |
| 467 | gamma:ConstTensor; |
| 468 | } |
| 469 | |
| 470 | table BatchNormalizationDescriptor { |
| 471 | eps:float; |
| 472 | dataLayout:DataLayout; |
| 473 | } |
| 474 | |
Nattapat Chaimanowong | 6522cdc | 2019-03-01 16:14:13 +0000 | [diff] [blame] | 475 | table ResizeBilinearLayer { |
| 476 | base:LayerBase; |
| 477 | descriptor:ResizeBilinearDescriptor; |
| 478 | } |
| 479 | |
| 480 | table ResizeBilinearDescriptor { |
| 481 | targetWidth:uint; |
| 482 | targetHeight:uint; |
| 483 | dataLayout:DataLayout; |
| 484 | } |
| 485 | |
Aron Virginas-Tar | 2fda80b | 2019-09-18 13:36:52 +0100 | [diff] [blame] | 486 | table SliceLayer { |
| 487 | base:LayerBase; |
| 488 | descriptor:SliceDescriptor; |
| 489 | } |
| 490 | |
| 491 | table SliceDescriptor { |
| 492 | begin:[uint]; |
| 493 | size:[uint]; |
| 494 | } |
| 495 | |
Nattapat Chaimanowong | b348521 | 2019-03-04 12:35:39 +0000 | [diff] [blame] | 496 | table StridedSliceLayer { |
| 497 | base:LayerBase; |
| 498 | descriptor:StridedSliceDescriptor; |
| 499 | } |
| 500 | |
| 501 | table StridedSliceDescriptor { |
| 502 | begin:[int]; |
| 503 | end:[int]; |
| 504 | stride:[int]; |
| 505 | beginMask:int; |
| 506 | endMask:int; |
| 507 | shrinkAxisMask:int; |
| 508 | ellipsisMask:int; |
| 509 | newAxisMask:int; |
| 510 | dataLayout:DataLayout; |
| 511 | } |
| 512 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 513 | table ConcatLayer { |
| 514 | base:LayerBase; |
| 515 | descriptor:OriginsDescriptor; |
| 516 | } |
| 517 | |
Jim Flynn | ac25a1b | 2019-02-28 10:40:49 +0000 | [diff] [blame] | 518 | table MergerLayer { |
| 519 | base:LayerBase; |
| 520 | descriptor:OriginsDescriptor; |
| 521 | } |
| 522 | |
| 523 | table UintVector { |
| 524 | data:[uint]; |
| 525 | } |
| 526 | |
| 527 | table OriginsDescriptor { |
| 528 | concatAxis:uint; |
| 529 | numViews:uint; |
| 530 | numDimensions:uint; |
| 531 | viewOrigins:[UintVector]; |
| 532 | } |
| 533 | |
Jim Flynn | 18ce338 | 2019-03-08 11:08:30 +0000 | [diff] [blame] | 534 | table ViewsDescriptor { |
| 535 | origins:OriginsDescriptor; |
| 536 | viewSizes:[UintVector]; |
| 537 | } |
| 538 | |
| 539 | table SplitterLayer { |
| 540 | base:LayerBase; |
| 541 | descriptor:ViewsDescriptor; |
| 542 | } |
| 543 | |
Nattapat Chaimanowong | 3e14a9d | 2019-03-18 12:37:06 +0000 | [diff] [blame] | 544 | table DetectionPostProcessLayer { |
| 545 | base:LayerBase; |
| 546 | descriptor:DetectionPostProcessDescriptor; |
| 547 | anchors:ConstTensor; |
| 548 | } |
| 549 | |
| 550 | table DetectionPostProcessDescriptor { |
| 551 | maxDetections:uint; |
| 552 | maxClassesPerDetection:uint; |
| 553 | detectionsPerClass:uint; |
| 554 | nmsScoreThreshold:float; |
| 555 | nmsIouThreshold:float; |
| 556 | numClasses:uint; |
| 557 | useRegularNms:bool; |
| 558 | scaleX:float; |
| 559 | scaleY:float; |
| 560 | scaleW:float; |
| 561 | scaleH:float; |
| 562 | } |
| 563 | |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 564 | table LstmInputParams { |
| 565 | inputToForgetWeights:ConstTensor; |
| 566 | inputToCellWeights:ConstTensor; |
| 567 | inputToOutputWeights:ConstTensor; |
| 568 | recurrentToForgetWeights:ConstTensor; |
| 569 | recurrentToCellWeights:ConstTensor; |
| 570 | recurrentToOutputWeights:ConstTensor; |
| 571 | forgetGateBias:ConstTensor; |
| 572 | cellBias:ConstTensor; |
| 573 | outputGateBias:ConstTensor; |
| 574 | |
| 575 | inputToInputWeights:ConstTensor; |
| 576 | recurrentToInputWeights:ConstTensor; |
| 577 | cellToInputWeights:ConstTensor; |
| 578 | inputGateBias:ConstTensor; |
| 579 | |
| 580 | projectionWeights:ConstTensor; |
| 581 | projectionBias:ConstTensor; |
| 582 | |
| 583 | cellToForgetWeights:ConstTensor; |
| 584 | cellToOutputWeights:ConstTensor; |
Jan Eilers | f8c6297 | 2019-07-17 11:07:49 +0100 | [diff] [blame] | 585 | |
| 586 | inputLayerNormWeights:ConstTensor; |
| 587 | forgetLayerNormWeights:ConstTensor; |
| 588 | cellLayerNormWeights:ConstTensor; |
| 589 | outputLayerNormWeights:ConstTensor; |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 590 | } |
| 591 | |
Jan Eilers | 5b01a89 | 2019-07-23 09:47:43 +0100 | [diff] [blame] | 592 | table QuantizedLstmInputParams { |
| 593 | inputToInputWeights:ConstTensor; |
| 594 | inputToForgetWeights:ConstTensor; |
| 595 | inputToCellWeights:ConstTensor; |
| 596 | inputToOutputWeights:ConstTensor; |
| 597 | |
| 598 | recurrentToInputWeights:ConstTensor; |
| 599 | recurrentToForgetWeights:ConstTensor; |
| 600 | recurrentToCellWeights:ConstTensor; |
| 601 | recurrentToOutputWeights:ConstTensor; |
| 602 | |
| 603 | inputGateBias:ConstTensor; |
| 604 | forgetGateBias:ConstTensor; |
| 605 | cellBias:ConstTensor; |
| 606 | outputGateBias:ConstTensor; |
| 607 | } |
| 608 | |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 609 | table LstmDescriptor { |
| 610 | activationFunc:uint; |
| 611 | clippingThresCell:float; |
| 612 | clippingThresProj:float; |
| 613 | cifgEnabled:bool = true; |
| 614 | peepholeEnabled:bool = false; |
| 615 | projectionEnabled:bool = false; |
Jan Eilers | f8c6297 | 2019-07-17 11:07:49 +0100 | [diff] [blame] | 616 | layerNormEnabled:bool = false; |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | table LstmLayer { |
| 620 | base:LayerBase; |
| 621 | descriptor:LstmDescriptor; |
| 622 | inputParams:LstmInputParams; |
| 623 | } |
| 624 | |
Jan Eilers | 5b01a89 | 2019-07-23 09:47:43 +0100 | [diff] [blame] | 625 | table QuantizedLstmLayer { |
| 626 | base:LayerBase; |
| 627 | inputParams:QuantizedLstmInputParams; |
| 628 | } |
| 629 | |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 630 | table DequantizeLayer { |
| 631 | base:LayerBase; |
| 632 | } |
| 633 | |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 634 | table MergeLayer { |
| 635 | base:LayerBase; |
| 636 | } |
| 637 | |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 638 | table SwitchLayer { |
| 639 | base:LayerBase; |
| 640 | } |
| 641 | |
Ellen Norris-Thompson | 5198247 | 2019-06-19 11:46:21 +0100 | [diff] [blame] | 642 | table PreluLayer { |
| 643 | base:LayerBase; |
| 644 | } |
| 645 | |
Aron Virginas-Tar | cb54930 | 2019-06-21 13:53:38 +0100 | [diff] [blame] | 646 | table TransposeConvolution2dLayer { |
| 647 | base:LayerBase; |
| 648 | descriptor:TransposeConvolution2dDescriptor; |
| 649 | weights:ConstTensor; |
| 650 | biases:ConstTensor; |
| 651 | } |
| 652 | |
| 653 | table TransposeConvolution2dDescriptor { |
| 654 | padLeft:uint; |
| 655 | padRight:uint; |
| 656 | padTop:uint; |
| 657 | padBottom:uint; |
| 658 | strideX:uint; |
| 659 | strideY:uint; |
| 660 | biasEnabled:bool = false; |
| 661 | dataLayout:DataLayout = NCHW; |
| 662 | } |
| 663 | |
FinnWilliamsArm | 6fb339a | 2019-06-28 15:07:10 +0100 | [diff] [blame] | 664 | table ResizeLayer { |
| 665 | base:LayerBase; |
| 666 | descriptor:ResizeDescriptor; |
| 667 | } |
| 668 | |
| 669 | table ResizeDescriptor { |
| 670 | targetHeight:uint; |
| 671 | targetWidth:uint; |
| 672 | method:ResizeMethod = NearestNeighbor; |
| 673 | dataLayout:DataLayout; |
| 674 | } |
| 675 | |
Matthew Jackson | b5433ee | 2019-07-11 15:54:20 +0100 | [diff] [blame] | 676 | table StackLayer { |
| 677 | base:LayerBase; |
| 678 | descriptor:StackDescriptor; |
| 679 | } |
| 680 | |
| 681 | table StackDescriptor { |
| 682 | axis:uint; |
| 683 | numInputs:uint; |
| 684 | inputShape:[uint]; |
| 685 | } |
| 686 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 687 | union Layer { |
Mike Kelly | af48401 | 2019-02-20 16:53:11 +0000 | [diff] [blame] | 688 | ActivationLayer, |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 689 | AdditionLayer, |
Nattapat Chaimanowong | 6b4ed98 | 2019-02-26 17:24:13 +0000 | [diff] [blame] | 690 | BatchToSpaceNdLayer, |
ruoyan01 | 8e7fa23 | 2019-02-28 15:09:07 +0000 | [diff] [blame] | 691 | BatchNormalizationLayer, |
Conor Kennedy | 7627788 | 2019-02-26 08:29:54 +0000 | [diff] [blame] | 692 | ConstantLayer, |
Mike Kelly | a0766c3 | 2019-02-19 17:22:07 +0000 | [diff] [blame] | 693 | Convolution2dLayer, |
Aron Virginas-Tar | c04125f | 2019-02-19 16:31:08 +0000 | [diff] [blame] | 694 | DepthwiseConvolution2dLayer, |
Sadik Armagan | dbb0c0c | 2019-02-21 09:01:41 +0000 | [diff] [blame] | 695 | FullyConnectedLayer, |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 696 | InputLayer, |
Sadik Armagan | 5f45027 | 2019-02-12 14:31:45 +0000 | [diff] [blame] | 697 | MultiplicationLayer, |
Aron Virginas-Tar | fc413c0 | 2019-02-13 15:41:52 +0000 | [diff] [blame] | 698 | OutputLayer, |
Nattapat Chaimanowong | 30b0020 | 2019-02-20 17:31:34 +0000 | [diff] [blame] | 699 | PermuteLayer, |
Saoirse Stewart | 3166c3e | 2019-02-18 15:24:53 +0000 | [diff] [blame] | 700 | Pooling2dLayer, |
Saoirse Stewart | 263829c | 2019-02-19 15:54:14 +0000 | [diff] [blame] | 701 | ReshapeLayer, |
Nattapat Chaimanowong | 4528699 | 2019-02-26 15:53:02 +0000 | [diff] [blame] | 702 | SoftmaxLayer, |
Éanna Ó Catháin | 5888589 | 2019-02-27 16:16:39 +0000 | [diff] [blame] | 703 | SpaceToBatchNdLayer, |
Aron Virginas-Tar | 0fe3245 | 2019-02-28 13:12:47 +0000 | [diff] [blame] | 704 | DivisionLayer, |
Nattapat Chaimanowong | 235cea5 | 2019-02-28 16:27:30 +0000 | [diff] [blame] | 705 | MinimumLayer, |
Aron Virginas-Tar | 377351e | 2019-02-27 14:42:31 +0000 | [diff] [blame] | 706 | EqualLayer, |
Nina Drozd | 5772878 | 2019-02-27 10:53:27 +0000 | [diff] [blame] | 707 | MaximumLayer, |
Nattapat Chaimanowong | ebb0f9c | 2019-03-01 12:14:06 +0000 | [diff] [blame] | 708 | NormalizationLayer, |
Sadik Armagan | 8b42a38 | 2019-03-01 14:24:49 +0000 | [diff] [blame] | 709 | PadLayer, |
Finn Williams | dd2ba7e | 2019-03-01 11:51:52 +0000 | [diff] [blame] | 710 | RsqrtLayer, |
Conor Kennedy | 79ffdf5 | 2019-03-01 14:24:54 +0000 | [diff] [blame] | 711 | FloorLayer, |
Nattapat Chaimanowong | 6522cdc | 2019-03-01 16:14:13 +0000 | [diff] [blame] | 712 | GreaterLayer, |
Conor Kennedy | da1f975 | 2019-03-01 14:37:12 +0000 | [diff] [blame] | 713 | ResizeBilinearLayer, |
Nattapat Chaimanowong | b348521 | 2019-03-04 12:35:39 +0000 | [diff] [blame] | 714 | SubtractionLayer, |
Saoirse Stewart | a1ed73a | 2019-03-04 13:40:12 +0000 | [diff] [blame] | 715 | StridedSliceLayer, |
Sadik Armagan | ac97c8c | 2019-03-04 17:44:21 +0000 | [diff] [blame] | 716 | GatherLayer, |
Jim Flynn | ac25a1b | 2019-02-28 10:40:49 +0000 | [diff] [blame] | 717 | MeanLayer, |
Narumol Prangnawarat | 495701f | 2019-03-07 17:31:34 +0000 | [diff] [blame] | 718 | MergerLayer, |
Jim Flynn | 18ce338 | 2019-03-08 11:08:30 +0000 | [diff] [blame] | 719 | L2NormalizationLayer, |
Nattapat Chaimanowong | 3e14a9d | 2019-03-18 12:37:06 +0000 | [diff] [blame] | 720 | SplitterLayer, |
Jim Flynn | 11af375 | 2019-03-19 17:22:29 +0000 | [diff] [blame] | 721 | DetectionPostProcessLayer, |
Derek Lamberti | 87acb27 | 2019-03-27 16:51:31 +0000 | [diff] [blame] | 722 | LstmLayer, |
Jan Eilers | 5b01a89 | 2019-07-23 09:47:43 +0100 | [diff] [blame] | 723 | QuantizedLstmLayer, |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 724 | QuantizeLayer, |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 725 | DequantizeLayer, |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 726 | MergeLayer, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 727 | SwitchLayer, |
Aron Virginas-Tar | aa06714 | 2019-06-11 16:01:44 +0100 | [diff] [blame] | 728 | ConcatLayer, |
Ellen Norris-Thompson | 5198247 | 2019-06-19 11:46:21 +0100 | [diff] [blame] | 729 | SpaceToDepthLayer, |
Aron Virginas-Tar | cb54930 | 2019-06-21 13:53:38 +0100 | [diff] [blame] | 730 | PreluLayer, |
FinnWilliamsArm | 6fb339a | 2019-06-28 15:07:10 +0100 | [diff] [blame] | 731 | TransposeConvolution2dLayer, |
Matthew Jackson | b5433ee | 2019-07-11 15:54:20 +0100 | [diff] [blame] | 732 | ResizeLayer, |
FinnWilliamsArm | 4ffcc8f | 2019-09-05 14:34:20 +0100 | [diff] [blame] | 733 | StackLayer, |
Narumol Prangnawarat | 0cfcf23 | 2019-09-09 17:16:24 +0100 | [diff] [blame] | 734 | AbsLayer, |
Aron Virginas-Tar | 2fda80b | 2019-09-18 13:36:52 +0100 | [diff] [blame] | 735 | ArgMinMaxLayer, |
Aron Virginas-Tar | da9d2d3 | 2019-09-20 10:42:02 +0100 | [diff] [blame] | 736 | SliceLayer, |
| 737 | DepthToSpaceLayer |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 738 | } |
| 739 | |
Saoirse Stewart | 49dbe0e | 2019-02-05 17:27:06 +0000 | [diff] [blame] | 740 | table AnyLayer { |
| 741 | layer:Layer; |
| 742 | } |
| 743 | |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 744 | // Root type for serialized data is the graph of the network |
| 745 | table SerializedGraph { |
Saoirse Stewart | 49dbe0e | 2019-02-05 17:27:06 +0000 | [diff] [blame] | 746 | layers:[AnyLayer]; |
Mike Kelly | 8c1701a | 2019-02-11 17:01:27 +0000 | [diff] [blame] | 747 | inputIds:[uint]; |
| 748 | outputIds:[uint]; |
Nattapat Chaimanowong | 969eea3 | 2019-01-30 13:33:11 +0000 | [diff] [blame] | 749 | } |
| 750 | |
| 751 | root_type SerializedGraph; |