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