blob: 1f71ce19f2b0bb16392a7220a13f65c643baf441 [file] [log] [blame]
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001//
Teresa Charlin52664732020-06-29 16:27:03 +01002// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00003// SPDX-License-Identifier: MIT
4//
5
Derek Lamberti0028d1b2019-02-20 13:57:42 +00006namespace armnnSerializer;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00007
8file_identifier "ARMN";
9
10file_extension "armnn";
11
Mike Kellyaf484012019-02-20 16:53:11 +000012enum 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,
David Monahan3b3c3812020-02-25 09:03:29 +000022 Square = 9,
Colm Donelan03fbeaf2020-02-26 15:39:23 +000023 Elu = 10,
24 HardSwish = 11
Mike Kellyaf484012019-02-20 16:53:11 +000025}
26
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +010027enum ArgMinMaxFunction : byte {
28 Min = 0,
29 Max = 1
30}
31
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000032enum DataType : byte {
33 Float16 = 0,
34 Float32 = 1,
Derek Lambertif90c56d2020-01-10 17:14:08 +000035 QuantisedAsymm8 = 2, // deprecated
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000036 Signed32 = 3,
Nattapat Chaimanowongcd5ac232019-03-19 12:26:36 +000037 Boolean = 4,
Derek Lambertif90c56d2020-01-10 17:14:08 +000038 QuantisedSymm16 = 5, // deprecated
39 QAsymmU8 = 6,
Francis Murtaghddb1d062020-03-10 13:51:45 +000040 QSymmS16 = 7,
Sadik Armagan1a84fe32020-03-27 15:56:57 +000041 QAsymmS8 = 8,
42 QSymmS8 = 9
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000043}
44
Saoirse Stewart3166c3e2019-02-18 15:24:53 +000045enum DataLayout : byte {
46 NHWC = 0,
47 NCHW = 1
48}
49
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +010050enum ResizeMethod: byte {
51 NearestNeighbor = 0,
52 Bilinear = 1,
53}
54
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000055table TensorInfo {
56 dimensions:[uint];
57 dataType:DataType;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000058 quantizationScale:float = 1.0; // @deprecated Use quantizationScales instead
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000059 quantizationOffset:int = 0;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000060 quantizationScales:[float];
61 quantizationDim:uint;
Finn Williams2605b232020-06-10 15:53:46 +010062 dimensionality:uint = 1;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000063}
64
65struct Connection {
66 sourceLayerIndex:uint;
67 outputSlotIndex:uint;
68}
69
70table ByteData {
71 data:[byte];
72}
73
74table ShortData {
75 data:[short];
76}
77
78table IntData {
79 data:[int];
80}
81
82table LongData {
83 data:[long];
84}
85
86union ConstTensorData { ByteData, ShortData, IntData, LongData }
87
88table ConstTensor {
89 info:TensorInfo;
90 data:ConstTensorData;
91}
92
93table InputSlot {
94 index:uint;
95 connection:Connection;
96}
97
98table OutputSlot {
99 index:uint;
100 tensorInfo:TensorInfo;
101}
102
103enum LayerType : uint {
104 Addition = 0,
105 Input = 1,
Sadik Armagan5f450272019-02-12 14:31:45 +0000106 Multiplication = 2,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000107 Output = 3,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000108 Pooling2d = 4,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000109 Reshape = 5,
Mike Kellya0766c32019-02-19 17:22:07 +0000110 Softmax = 6,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000111 Convolution2d = 7,
Mike Kellyaf484012019-02-20 16:53:11 +0000112 DepthwiseConvolution2d = 8,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000113 Activation = 9,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000114 Permute = 10,
Conor Kennedy76277882019-02-26 08:29:54 +0000115 FullyConnected = 11,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000116 Constant = 12,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000117 SpaceToBatchNd = 13,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000118 BatchToSpaceNd = 14,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000119 Division = 15,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000120 Minimum = 16,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000121 Equal = 17,
Nina Drozd57728782019-02-27 10:53:27 +0000122 Maximum = 18,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000123 Normalization = 19,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000124 Pad = 20,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000125 Rsqrt = 21,
ruoyan018e7fa232019-02-28 15:09:07 +0000126 Floor = 22,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000127 BatchNormalization = 23,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000128 Greater = 24,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000129 ResizeBilinear = 25,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000130 Subtraction = 26,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000131 StridedSlice = 27,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000132 Gather = 28,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000133 Mean = 29,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000134 Merger = 30,
Jim Flynn18ce3382019-03-08 11:08:30 +0000135 L2Normalization = 31,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000136 Splitter = 32,
Jim Flynn11af3752019-03-19 17:22:29 +0000137 DetectionPostProcess = 33,
Derek Lamberti87acb272019-03-27 16:51:31 +0000138 Lstm = 34,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000139 Quantize = 35,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100140 Dequantize = 36,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100141 Merge = 37,
Jim Flynne242f2d2019-05-22 14:24:13 +0100142 Switch = 38,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100143 Concat = 39,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100144 SpaceToDepth = 40,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100145 Prelu = 41,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100146 TransposeConvolution2d = 42,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100147 Resize = 43,
Jan Eilers5b01a892019-07-23 09:47:43 +0100148 Stack = 44,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100149 QuantizedLstm = 45,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100150 Abs = 46,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100151 ArgMinMax = 47,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100152 Slice = 48,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100153 DepthToSpace = 49,
Sadik Armagan26257852019-10-14 13:00:47 +0100154 InstanceNormalization = 50,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100155 LogSoftmax = 51,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100156 Comparison = 52,
josh minor4a3c6102020-01-06 16:40:46 -0600157 StandIn = 53,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000158 ElementwiseUnary = 54,
James Conroy8d333182020-05-13 10:27:58 +0100159 Transpose = 55,
Keith Davis300ad562020-06-04 16:34:23 +0100160 QLstm = 56,
Finn Williams2605b232020-06-10 15:53:46 +0100161 Fill = 57,
James Conroyaba90cd2020-11-06 16:28:18 +0000162 Rank = 58,
163 LogicalBinary = 59
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000164}
165
166// Base layer table to be used as part of other layers
167table LayerBase {
168 index:uint;
169 layerName:string;
170 layerType:LayerType;
171 inputSlots:[InputSlot];
172 outputSlots:[OutputSlot];
173}
174
175table BindableLayerBase {
176 base:LayerBase;
177 layerBindingId:int;
178}
179
180// Table for each layer defined below
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100181
josh minor4a3c6102020-01-06 16:40:46 -0600182/// @deprecated Use ElementwiseUnaryLayer instead
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100183table AbsLayer {
184 base:LayerBase;
185}
186
Mike Kellyaf484012019-02-20 16:53:11 +0000187table ActivationLayer {
188 base:LayerBase;
189 descriptor:ActivationDescriptor;
190}
191
192table ActivationDescriptor {
Tee Jung86bc3d82019-10-01 11:25:56 +0900193 activationFunction:ActivationFunction = Sigmoid;
Mike Kellyaf484012019-02-20 16:53:11 +0000194 a:float;
195 b:float;
196}
197
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000198table AdditionLayer {
199 base:LayerBase;
200}
201
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100202table ArgMinMaxLayer {
203 base:LayerBase;
204 descriptor:ArgMinMaxDescriptor;
205}
206
207table ArgMinMaxDescriptor{
Tee Jung86bc3d82019-10-01 11:25:56 +0900208 argMinMaxFunction:ArgMinMaxFunction;
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100209 axis:int;
210}
211
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100212enum ComparisonOperation : byte {
213 Equal = 0,
214 Greater = 1,
215 GreaterOrEqual = 2,
216 Less = 3,
217 LessOrEqual = 4,
218 NotEqual = 5
219}
220
221table ComparisonDescriptor {
222 operation:ComparisonOperation;
223}
224
225table ComparisonLayer {
226 base:LayerBase;
227 descriptor:ComparisonDescriptor;
228}
229
Conor Kennedy76277882019-02-26 08:29:54 +0000230table ConstantLayer {
231 base:LayerBase;
232 input:ConstTensor;
233}
234
Mike Kellya0766c32019-02-19 17:22:07 +0000235table Convolution2dLayer {
236 base:LayerBase;
237 descriptor:Convolution2dDescriptor;
238 weights:ConstTensor;
239 biases:ConstTensor;
240}
241
242table Convolution2dDescriptor {
243 padLeft:uint;
244 padRight:uint;
245 padTop:uint;
246 padBottom:uint;
247 strideX:uint;
248 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100249 dilationX:uint = 1;
250 dilationY:uint = 1;
Mike Kellya0766c32019-02-19 17:22:07 +0000251 biasEnabled:bool = false;
252 dataLayout:DataLayout = NCHW;
253}
254
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100255table DepthToSpaceLayer {
256 base:LayerBase;
257 descriptor:DepthToSpaceDescriptor;
258}
259
260table DepthToSpaceDescriptor {
261 blockSize:uint;
262 dataLayout:DataLayout;
263}
264
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000265table DivisionLayer {
266 base:LayerBase;
267}
268
josh minor4a3c6102020-01-06 16:40:46 -0600269enum UnaryOperation : byte {
270 Abs = 0,
271 Rsqrt = 1,
272 Sqrt = 2,
273 Exp = 3,
James Conroyaba90cd2020-11-06 16:28:18 +0000274 Neg = 4,
275 LogicalNot = 5
josh minor4a3c6102020-01-06 16:40:46 -0600276}
277
278table ElementwiseUnaryDescriptor {
279 operation:UnaryOperation;
280}
281
282table ElementwiseUnaryLayer {
283 base:LayerBase;
284 descriptor:ElementwiseUnaryDescriptor;
285}
286
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100287/// @deprecated Use ComparisonLayer instead
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000288table EqualLayer {
289 base:LayerBase;
290}
291
Keith Davis300ad562020-06-04 16:34:23 +0100292table FillLayer {
293 base:LayerBase;
294 descriptor:FillDescriptor;
295}
296
297table FillDescriptor {
298 value:float;
299}
300
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000301table FloorLayer{
302 base:LayerBase;
303}
304
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000305table FullyConnectedLayer {
306 base:LayerBase;
307 descriptor:FullyConnectedDescriptor;
308 weights:ConstTensor;
309 biases:ConstTensor;
310}
311
312table FullyConnectedDescriptor {
313 biasEnabled:bool = false;
314 transposeWeightsMatrix:bool = false;
315}
316
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000317table GatherLayer {
318 base:LayerBase;
Teresa Charlin52664732020-06-29 16:27:03 +0100319 descriptor:GatherDescriptor;
320}
321
322table GatherDescriptor {
323 axis:int = 0;
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000324}
325
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100326/// @deprecated Use ComparisonLayer instead
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000327table GreaterLayer {
328 base:LayerBase;
329}
330
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000331table InputLayer {
332 base:BindableLayerBase;
333}
334
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100335table InstanceNormalizationLayer {
336 base:LayerBase;
337 descriptor:InstanceNormalizationDescriptor;
338}
339
340table InstanceNormalizationDescriptor {
341 gamma:float;
342 beta:float;
343 eps:float;
344 dataLayout:DataLayout;
345}
346
Sadik Armagan26257852019-10-14 13:00:47 +0100347table LogSoftmaxLayer {
348 base:LayerBase;
349 descriptor:LogSoftmaxDescriptor;
350}
351
352table LogSoftmaxDescriptor {
353 beta:float = 1;
354 axis:int = -1;
355}
356
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000357table L2NormalizationLayer {
358 base:LayerBase;
359 descriptor:L2NormalizationDescriptor;
360}
361
362table L2NormalizationDescriptor {
363 dataLayout:DataLayout = NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100364 eps:float = 1e-12;
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000365}
366
James Conroyaba90cd2020-11-06 16:28:18 +0000367enum LogicalBinaryOperation : byte {
368 LogicalAnd = 0,
369 LogicalOr = 1
370}
371
372table LogicalBinaryDescriptor {
373 operation:LogicalBinaryOperation;
374}
375
376table LogicalBinaryLayer {
377 base:LayerBase;
378 descriptor:LogicalBinaryDescriptor;
379}
380
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000381table MinimumLayer {
382 base:LayerBase;
383}
384
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000385table MaximumLayer {
386 base:LayerBase;
387}
388
Sadik Armagan5f450272019-02-12 14:31:45 +0000389table MultiplicationLayer {
390 base:LayerBase;
391}
392
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000393table Pooling2dLayer {
394 base:LayerBase;
395 descriptor:Pooling2dDescriptor;
396}
397
398enum PoolingAlgorithm : byte {
399 Max = 0,
400 Average = 1,
401 L2 = 2
402}
403
404enum OutputShapeRounding : byte {
405 Floor = 0,
406 Ceiling = 1
407}
408
409enum PaddingMethod : byte {
410 IgnoreValue = 0,
411 Exclude = 1
412}
413
414table Pooling2dDescriptor {
415 poolType:PoolingAlgorithm;
416 padLeft:uint;
417 padRight:uint;
418 padTop:uint;
419 padBottom:uint;
420 poolWidth:uint;
421 poolHeight:uint;
422 strideX:uint;
423 strideY:uint;
424 outputShapeRounding:OutputShapeRounding;
425 paddingMethod:PaddingMethod;
426 dataLayout:DataLayout;
427}
428
Derek Lamberti87acb272019-03-27 16:51:31 +0000429table QuantizeLayer {
430 base:LayerBase;
431}
432
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000433table SoftmaxLayer {
434 base:LayerBase;
435 descriptor:SoftmaxDescriptor;
436}
437
438table SoftmaxDescriptor {
439 beta:float;
440}
441
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000442table DepthwiseConvolution2dLayer {
443 base:LayerBase;
444 descriptor:DepthwiseConvolution2dDescriptor;
445 weights:ConstTensor;
446 biases:ConstTensor;
447}
448
449table DepthwiseConvolution2dDescriptor {
450 padLeft:uint;
451 padRight:uint;
452 padTop:uint;
453 padBottom:uint;
454 strideX:uint;
455 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100456 dilationX:uint = 1;
457 dilationY:uint = 1;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000458 biasEnabled:bool = false;
459 dataLayout:DataLayout = NCHW;
460}
461
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000462table OutputLayer {
463 base:BindableLayerBase;
464}
465
Saoirse Stewart263829c2019-02-19 15:54:14 +0000466table ReshapeLayer {
467 base:LayerBase;
468 descriptor:ReshapeDescriptor;
469}
470
471table ReshapeDescriptor {
472 targetShape:[uint];
473}
474
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000475table PermuteLayer {
476 base:LayerBase;
477 descriptor:PermuteDescriptor;
478}
479
480table PermuteDescriptor {
481 dimMappings:[uint];
482}
483
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000484table SpaceToBatchNdLayer {
485 base:LayerBase;
486 descriptor:SpaceToBatchNdDescriptor;
487}
488
489table SpaceToBatchNdDescriptor {
490 blockShape:[uint];
491 padList:[uint];
492 dataLayout:DataLayout;
493}
494
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100495table SpaceToDepthLayer {
496 base:LayerBase;
497 descriptor:SpaceToDepthDescriptor;
498}
499
500table SpaceToDepthDescriptor {
501 blockSize:uint;
502 dataLayout:DataLayout;
503}
504
Conor Kennedyda1f9752019-03-01 14:37:12 +0000505table SubtractionLayer {
506 base:LayerBase;
507}
508
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000509table BatchToSpaceNdLayer {
510 base:LayerBase;
511 descriptor:BatchToSpaceNdDescriptor;
512}
513
514table BatchToSpaceNdDescriptor {
515 blockShape:[uint];
516 crops:[uint];
517 dataLayout:DataLayout;
518}
519
Nina Drozd57728782019-02-27 10:53:27 +0000520enum NormalizationAlgorithmChannel : byte {
521 Across = 0,
522 Within = 1
523}
524
525enum NormalizationAlgorithmMethod : byte {
526 LocalBrightness = 0,
527 LocalContrast = 1
528}
529
530table NormalizationLayer {
531 base:LayerBase;
532 descriptor:NormalizationDescriptor;
533}
534
535table NormalizationDescriptor {
536 normChannelType:NormalizationAlgorithmChannel = Across;
537 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
538 normSize:uint;
539 alpha:float;
540 beta:float;
541 k:float;
542 dataLayout:DataLayout = NCHW;
543}
544
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000545table MeanLayer {
546 base:LayerBase;
547 descriptor:MeanDescriptor;
548}
549
550table MeanDescriptor {
551 axis:[uint];
552 keepDims:bool = false;
553}
554
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000555table PadLayer {
556 base:LayerBase;
557 descriptor:PadDescriptor;
558}
559
560table PadDescriptor {
561 padList:[uint];
David Monahan34757812019-06-19 11:47:21 +0100562 padValue:float = 0;
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000563}
564
josh minor4a3c6102020-01-06 16:40:46 -0600565/// @deprecated Use ElementwiseUnaryLayer instead
Sadik Armagan8b42a382019-03-01 14:24:49 +0000566table RsqrtLayer {
567 base:LayerBase;
568}
569
ruoyan018e7fa232019-02-28 15:09:07 +0000570table BatchNormalizationLayer {
571 base:LayerBase;
572 descriptor:BatchNormalizationDescriptor;
573 mean:ConstTensor;
574 variance:ConstTensor;
575 beta:ConstTensor;
576 gamma:ConstTensor;
577}
578
579table BatchNormalizationDescriptor {
580 eps:float;
581 dataLayout:DataLayout;
582}
583
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100584/// @deprecated Use ResizeLayer instead
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000585table ResizeBilinearLayer {
586 base:LayerBase;
587 descriptor:ResizeBilinearDescriptor;
588}
589
590table ResizeBilinearDescriptor {
591 targetWidth:uint;
592 targetHeight:uint;
593 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100594 alignCorners:bool;
595 halfPixelCenters:bool;
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000596}
597
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100598table SliceLayer {
599 base:LayerBase;
600 descriptor:SliceDescriptor;
601}
602
603table SliceDescriptor {
604 begin:[uint];
605 size:[uint];
606}
607
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000608table StridedSliceLayer {
609 base:LayerBase;
610 descriptor:StridedSliceDescriptor;
611}
612
613table StridedSliceDescriptor {
614 begin:[int];
615 end:[int];
616 stride:[int];
617 beginMask:int;
618 endMask:int;
619 shrinkAxisMask:int;
620 ellipsisMask:int;
621 newAxisMask:int;
622 dataLayout:DataLayout;
623}
624
Jim Flynne242f2d2019-05-22 14:24:13 +0100625table ConcatLayer {
626 base:LayerBase;
627 descriptor:OriginsDescriptor;
628}
629
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100630/// @deprecated Use ConcatLayer instead
Jim Flynnac25a1b2019-02-28 10:40:49 +0000631table MergerLayer {
632 base:LayerBase;
633 descriptor:OriginsDescriptor;
634}
635
636table UintVector {
637 data:[uint];
638}
639
640table OriginsDescriptor {
641 concatAxis:uint;
642 numViews:uint;
643 numDimensions:uint;
644 viewOrigins:[UintVector];
645}
646
Jim Flynn18ce3382019-03-08 11:08:30 +0000647table ViewsDescriptor {
648 origins:OriginsDescriptor;
649 viewSizes:[UintVector];
650}
651
652table SplitterLayer {
653 base:LayerBase;
654 descriptor:ViewsDescriptor;
655}
656
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000657table DetectionPostProcessLayer {
658 base:LayerBase;
659 descriptor:DetectionPostProcessDescriptor;
660 anchors:ConstTensor;
661}
662
663table DetectionPostProcessDescriptor {
664 maxDetections:uint;
665 maxClassesPerDetection:uint;
666 detectionsPerClass:uint;
667 nmsScoreThreshold:float;
668 nmsIouThreshold:float;
669 numClasses:uint;
670 useRegularNms:bool;
671 scaleX:float;
672 scaleY:float;
673 scaleW:float;
674 scaleH:float;
675}
676
Jim Flynn11af3752019-03-19 17:22:29 +0000677table LstmInputParams {
678 inputToForgetWeights:ConstTensor;
679 inputToCellWeights:ConstTensor;
680 inputToOutputWeights:ConstTensor;
681 recurrentToForgetWeights:ConstTensor;
682 recurrentToCellWeights:ConstTensor;
683 recurrentToOutputWeights:ConstTensor;
684 forgetGateBias:ConstTensor;
685 cellBias:ConstTensor;
686 outputGateBias:ConstTensor;
687
688 inputToInputWeights:ConstTensor;
689 recurrentToInputWeights:ConstTensor;
690 cellToInputWeights:ConstTensor;
691 inputGateBias:ConstTensor;
692
693 projectionWeights:ConstTensor;
694 projectionBias:ConstTensor;
695
696 cellToForgetWeights:ConstTensor;
697 cellToOutputWeights:ConstTensor;
Jan Eilersf8c62972019-07-17 11:07:49 +0100698
699 inputLayerNormWeights:ConstTensor;
700 forgetLayerNormWeights:ConstTensor;
701 cellLayerNormWeights:ConstTensor;
702 outputLayerNormWeights:ConstTensor;
Jim Flynn11af3752019-03-19 17:22:29 +0000703}
704
James Conroy8d333182020-05-13 10:27:58 +0100705table LstmDescriptor {
706 activationFunc:uint;
707 clippingThresCell:float;
708 clippingThresProj:float;
709 cifgEnabled:bool = true;
710 peepholeEnabled:bool = false;
711 projectionEnabled:bool = false;
712 layerNormEnabled:bool = false;
713}
714
715table LstmLayer {
716 base:LayerBase;
717 descriptor:LstmDescriptor;
718 inputParams:LstmInputParams;
719}
720
721table QLstmInputParams {
722 // Mandatory
723 inputToForgetWeights:ConstTensor;
724 inputToCellWeights:ConstTensor;
725 inputToOutputWeights:ConstTensor;
726
727 recurrentToForgetWeights:ConstTensor;
728 recurrentToCellWeights:ConstTensor;
729 recurrentToOutputWeights:ConstTensor;
730
731 forgetGateBias:ConstTensor;
732 cellBias:ConstTensor;
733 outputGateBias:ConstTensor;
734
735 // CIFG
736 inputToInputWeights:ConstTensor;
737 recurrentToInputWeights:ConstTensor;
738 inputGateBias:ConstTensor;
739
740 // Projection
741 projectionWeights:ConstTensor;
742 projectionBias:ConstTensor;
743
744 // Peephole
745 cellToInputWeights:ConstTensor;
746 cellToForgetWeights:ConstTensor;
747 cellToOutputWeights:ConstTensor;
748
749 // Layer norm
750 inputLayerNormWeights:ConstTensor;
751 forgetLayerNormWeights:ConstTensor;
752 cellLayerNormWeights:ConstTensor;
753 outputLayerNormWeights:ConstTensor;
754}
755
756table QLstmDescriptor {
757 cifgEnabled:bool = true;
758 peepholeEnabled:bool = false;
759 projectionEnabled:bool = false;
760 layerNormEnabled:bool = false;
761
762 cellClip:float;
763 projectionClip:float;
764
765 inputIntermediateScale:float;
766 forgetIntermediateScale:float;
767 cellIntermediateScale:float;
768 outputIntermediateScale:float;
769
770 hiddenStateZeroPoint:int;
771 hiddenStateScale:float;
772}
773
774table QLstmLayer {
775 base:LayerBase;
776 descriptor:QLstmDescriptor;
777 inputParams:QLstmInputParams;
778}
779
Jan Eilers5b01a892019-07-23 09:47:43 +0100780table QuantizedLstmInputParams {
781 inputToInputWeights:ConstTensor;
782 inputToForgetWeights:ConstTensor;
783 inputToCellWeights:ConstTensor;
784 inputToOutputWeights:ConstTensor;
785
786 recurrentToInputWeights:ConstTensor;
787 recurrentToForgetWeights:ConstTensor;
788 recurrentToCellWeights:ConstTensor;
789 recurrentToOutputWeights:ConstTensor;
790
791 inputGateBias:ConstTensor;
792 forgetGateBias:ConstTensor;
793 cellBias:ConstTensor;
794 outputGateBias:ConstTensor;
795}
796
Jan Eilers5b01a892019-07-23 09:47:43 +0100797table QuantizedLstmLayer {
798 base:LayerBase;
799 inputParams:QuantizedLstmInputParams;
800}
801
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000802table DequantizeLayer {
803 base:LayerBase;
804}
805
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100806table MergeLayer {
807 base:LayerBase;
808}
809
Sadik Armaganeff363d2019-04-05 15:25:46 +0100810table SwitchLayer {
811 base:LayerBase;
812}
813
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100814table PreluLayer {
815 base:LayerBase;
816}
817
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100818table TransposeConvolution2dLayer {
819 base:LayerBase;
820 descriptor:TransposeConvolution2dDescriptor;
821 weights:ConstTensor;
822 biases:ConstTensor;
823}
824
825table TransposeConvolution2dDescriptor {
826 padLeft:uint;
827 padRight:uint;
828 padTop:uint;
829 padBottom:uint;
830 strideX:uint;
831 strideY:uint;
832 biasEnabled:bool = false;
833 dataLayout:DataLayout = NCHW;
834}
835
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000836table TransposeLayer {
837 base:LayerBase;
838 descriptor:TransposeDescriptor;
839}
840
841table TransposeDescriptor {
842 dimMappings:[uint];
843}
844
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100845table ResizeLayer {
846 base:LayerBase;
847 descriptor:ResizeDescriptor;
848}
849
850table ResizeDescriptor {
851 targetHeight:uint;
852 targetWidth:uint;
853 method:ResizeMethod = NearestNeighbor;
854 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100855 alignCorners:bool;
856 halfPixelCenters:bool;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100857}
858
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100859table StackLayer {
860 base:LayerBase;
861 descriptor:StackDescriptor;
862}
863
864table StackDescriptor {
865 axis:uint;
866 numInputs:uint;
867 inputShape:[uint];
868}
869
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100870table StandInDescriptor {
871 numInputs:uint;
872 numOutputs:uint;
873}
874
875table StandInLayer {
876 base:LayerBase;
877 descriptor:StandInDescriptor;
878}
879
Finn Williams2605b232020-06-10 15:53:46 +0100880table RankLayer {
881 base:LayerBase;
882}
883
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000884union Layer {
Mike Kellyaf484012019-02-20 16:53:11 +0000885 ActivationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000886 AdditionLayer,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000887 BatchToSpaceNdLayer,
ruoyan018e7fa232019-02-28 15:09:07 +0000888 BatchNormalizationLayer,
Conor Kennedy76277882019-02-26 08:29:54 +0000889 ConstantLayer,
Mike Kellya0766c32019-02-19 17:22:07 +0000890 Convolution2dLayer,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000891 DepthwiseConvolution2dLayer,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000892 FullyConnectedLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000893 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +0000894 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000895 OutputLayer,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000896 PermuteLayer,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000897 Pooling2dLayer,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000898 ReshapeLayer,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000899 SoftmaxLayer,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000900 SpaceToBatchNdLayer,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000901 DivisionLayer,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000902 MinimumLayer,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000903 EqualLayer,
Nina Drozd57728782019-02-27 10:53:27 +0000904 MaximumLayer,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000905 NormalizationLayer,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000906 PadLayer,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000907 RsqrtLayer,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000908 FloorLayer,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000909 GreaterLayer,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000910 ResizeBilinearLayer,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000911 SubtractionLayer,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000912 StridedSliceLayer,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000913 GatherLayer,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000914 MeanLayer,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000915 MergerLayer,
Jim Flynn18ce3382019-03-08 11:08:30 +0000916 L2NormalizationLayer,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000917 SplitterLayer,
Jim Flynn11af3752019-03-19 17:22:29 +0000918 DetectionPostProcessLayer,
Derek Lamberti87acb272019-03-27 16:51:31 +0000919 LstmLayer,
Jan Eilers5b01a892019-07-23 09:47:43 +0100920 QuantizedLstmLayer,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000921 QuantizeLayer,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100922 DequantizeLayer,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100923 MergeLayer,
Jim Flynne242f2d2019-05-22 14:24:13 +0100924 SwitchLayer,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100925 ConcatLayer,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100926 SpaceToDepthLayer,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100927 PreluLayer,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100928 TransposeConvolution2dLayer,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100929 ResizeLayer,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100930 StackLayer,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100931 AbsLayer,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100932 ArgMinMaxLayer,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100933 SliceLayer,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100934 DepthToSpaceLayer,
Sadik Armagan26257852019-10-14 13:00:47 +0100935 InstanceNormalizationLayer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100936 LogSoftmaxLayer,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100937 ComparisonLayer,
josh minor4a3c6102020-01-06 16:40:46 -0600938 StandInLayer,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000939 ElementwiseUnaryLayer,
James Conroy8d333182020-05-13 10:27:58 +0100940 TransposeLayer,
Keith Davis300ad562020-06-04 16:34:23 +0100941 QLstmLayer,
Finn Williams2605b232020-06-10 15:53:46 +0100942 FillLayer,
James Conroyaba90cd2020-11-06 16:28:18 +0000943 RankLayer,
944 LogicalBinaryLayer
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000945}
946
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000947table AnyLayer {
948 layer:Layer;
949}
950
Tee Jungaa920c52019-11-05 10:48:25 +0000951table FeatureCompatibilityVersions {
952 bindingIdsScheme:uint = 0;
953}
954
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000955// Root type for serialized data is the graph of the network
956table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000957 layers:[AnyLayer];
Tee Jungaa920c52019-11-05 10:48:25 +0000958 inputIds:[int];
959 outputIds:[int];
960 featureVersions:FeatureCompatibilityVersions;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000961}
962
Keith Davis300ad562020-06-04 16:34:23 +0100963root_type SerializedGraph;