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