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