blob: e2b3a3c288d71d7eb4ac65a032f1f490f8cbfd89 [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
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +000050enum ReduceOperation: byte {
51 Sum = 0,
52 Max = 1,
53 Mean = 2,
54 Min = 3
55}
56
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +010057enum ResizeMethod: byte {
58 NearestNeighbor = 0,
59 Bilinear = 1,
60}
61
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000062table TensorInfo {
63 dimensions:[uint];
64 dataType:DataType;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000065 quantizationScale:float = 1.0; // @deprecated Use quantizationScales instead
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000066 quantizationOffset:int = 0;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000067 quantizationScales:[float];
68 quantizationDim:uint;
Finn Williams2605b232020-06-10 15:53:46 +010069 dimensionality:uint = 1;
Colm Donelan800b2812021-02-12 12:43:35 +000070 dimensionSpecificity:[bool];
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000071}
72
73struct Connection {
74 sourceLayerIndex:uint;
75 outputSlotIndex:uint;
76}
77
78table ByteData {
79 data:[byte];
80}
81
82table ShortData {
83 data:[short];
84}
85
86table IntData {
87 data:[int];
88}
89
90table LongData {
91 data:[long];
92}
93
94union ConstTensorData { ByteData, ShortData, IntData, LongData }
95
96table ConstTensor {
97 info:TensorInfo;
98 data:ConstTensorData;
99}
100
101table InputSlot {
102 index:uint;
103 connection:Connection;
104}
105
106table OutputSlot {
107 index:uint;
108 tensorInfo:TensorInfo;
109}
110
111enum LayerType : uint {
112 Addition = 0,
113 Input = 1,
Sadik Armagan5f450272019-02-12 14:31:45 +0000114 Multiplication = 2,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000115 Output = 3,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000116 Pooling2d = 4,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000117 Reshape = 5,
Mike Kellya0766c32019-02-19 17:22:07 +0000118 Softmax = 6,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000119 Convolution2d = 7,
Mike Kellyaf484012019-02-20 16:53:11 +0000120 DepthwiseConvolution2d = 8,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000121 Activation = 9,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000122 Permute = 10,
Conor Kennedy76277882019-02-26 08:29:54 +0000123 FullyConnected = 11,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000124 Constant = 12,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000125 SpaceToBatchNd = 13,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000126 BatchToSpaceNd = 14,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000127 Division = 15,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000128 Minimum = 16,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000129 Equal = 17,
Nina Drozd57728782019-02-27 10:53:27 +0000130 Maximum = 18,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000131 Normalization = 19,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000132 Pad = 20,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000133 Rsqrt = 21,
ruoyan018e7fa232019-02-28 15:09:07 +0000134 Floor = 22,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000135 BatchNormalization = 23,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000136 Greater = 24,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000137 ResizeBilinear = 25,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000138 Subtraction = 26,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000139 StridedSlice = 27,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000140 Gather = 28,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000141 Mean = 29,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000142 Merger = 30,
Jim Flynn18ce3382019-03-08 11:08:30 +0000143 L2Normalization = 31,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000144 Splitter = 32,
Jim Flynn11af3752019-03-19 17:22:29 +0000145 DetectionPostProcess = 33,
Derek Lamberti87acb272019-03-27 16:51:31 +0000146 Lstm = 34,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000147 Quantize = 35,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100148 Dequantize = 36,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100149 Merge = 37,
Jim Flynne242f2d2019-05-22 14:24:13 +0100150 Switch = 38,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100151 Concat = 39,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100152 SpaceToDepth = 40,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100153 Prelu = 41,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100154 TransposeConvolution2d = 42,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100155 Resize = 43,
Jan Eilers5b01a892019-07-23 09:47:43 +0100156 Stack = 44,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100157 QuantizedLstm = 45,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100158 Abs = 46,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100159 ArgMinMax = 47,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100160 Slice = 48,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100161 DepthToSpace = 49,
Sadik Armagan26257852019-10-14 13:00:47 +0100162 InstanceNormalization = 50,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100163 LogSoftmax = 51,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100164 Comparison = 52,
josh minor4a3c6102020-01-06 16:40:46 -0600165 StandIn = 53,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000166 ElementwiseUnary = 54,
James Conroy8d333182020-05-13 10:27:58 +0100167 Transpose = 55,
Keith Davis300ad562020-06-04 16:34:23 +0100168 QLstm = 56,
Finn Williams2605b232020-06-10 15:53:46 +0100169 Fill = 57,
James Conroyaba90cd2020-11-06 16:28:18 +0000170 Rank = 58,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000171 LogicalBinary = 59,
172 Reduce = 60
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000173}
174
175// Base layer table to be used as part of other layers
176table LayerBase {
177 index:uint;
178 layerName:string;
179 layerType:LayerType;
180 inputSlots:[InputSlot];
181 outputSlots:[OutputSlot];
182}
183
184table BindableLayerBase {
185 base:LayerBase;
186 layerBindingId:int;
187}
188
189// Table for each layer defined below
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100190
josh minor4a3c6102020-01-06 16:40:46 -0600191/// @deprecated Use ElementwiseUnaryLayer instead
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100192table AbsLayer {
193 base:LayerBase;
194}
195
Mike Kellyaf484012019-02-20 16:53:11 +0000196table ActivationLayer {
197 base:LayerBase;
198 descriptor:ActivationDescriptor;
199}
200
201table ActivationDescriptor {
Tee Jung86bc3d82019-10-01 11:25:56 +0900202 activationFunction:ActivationFunction = Sigmoid;
Mike Kellyaf484012019-02-20 16:53:11 +0000203 a:float;
204 b:float;
205}
206
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000207table AdditionLayer {
208 base:LayerBase;
209}
210
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100211table ArgMinMaxLayer {
212 base:LayerBase;
213 descriptor:ArgMinMaxDescriptor;
214}
215
216table ArgMinMaxDescriptor{
Tee Jung86bc3d82019-10-01 11:25:56 +0900217 argMinMaxFunction:ArgMinMaxFunction;
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100218 axis:int;
219}
220
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100221enum ComparisonOperation : byte {
222 Equal = 0,
223 Greater = 1,
224 GreaterOrEqual = 2,
225 Less = 3,
226 LessOrEqual = 4,
227 NotEqual = 5
228}
229
230table ComparisonDescriptor {
231 operation:ComparisonOperation;
232}
233
234table ComparisonLayer {
235 base:LayerBase;
236 descriptor:ComparisonDescriptor;
237}
238
Conor Kennedy76277882019-02-26 08:29:54 +0000239table ConstantLayer {
240 base:LayerBase;
241 input:ConstTensor;
242}
243
Mike Kellya0766c32019-02-19 17:22:07 +0000244table Convolution2dLayer {
245 base:LayerBase;
246 descriptor:Convolution2dDescriptor;
247 weights:ConstTensor;
248 biases:ConstTensor;
249}
250
251table Convolution2dDescriptor {
252 padLeft:uint;
253 padRight:uint;
254 padTop:uint;
255 padBottom:uint;
256 strideX:uint;
257 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100258 dilationX:uint = 1;
259 dilationY:uint = 1;
Mike Kellya0766c32019-02-19 17:22:07 +0000260 biasEnabled:bool = false;
261 dataLayout:DataLayout = NCHW;
262}
263
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100264table DepthToSpaceLayer {
265 base:LayerBase;
266 descriptor:DepthToSpaceDescriptor;
267}
268
269table DepthToSpaceDescriptor {
270 blockSize:uint;
271 dataLayout:DataLayout;
272}
273
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000274table DivisionLayer {
275 base:LayerBase;
276}
277
josh minor4a3c6102020-01-06 16:40:46 -0600278enum UnaryOperation : byte {
279 Abs = 0,
280 Rsqrt = 1,
281 Sqrt = 2,
282 Exp = 3,
James Conroyaba90cd2020-11-06 16:28:18 +0000283 Neg = 4,
284 LogicalNot = 5
josh minor4a3c6102020-01-06 16:40:46 -0600285}
286
287table ElementwiseUnaryDescriptor {
288 operation:UnaryOperation;
289}
290
291table ElementwiseUnaryLayer {
292 base:LayerBase;
293 descriptor:ElementwiseUnaryDescriptor;
294}
295
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100296/// @deprecated Use ComparisonLayer instead
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000297table EqualLayer {
298 base:LayerBase;
299}
300
Keith Davis300ad562020-06-04 16:34:23 +0100301table FillLayer {
302 base:LayerBase;
303 descriptor:FillDescriptor;
304}
305
306table FillDescriptor {
307 value:float;
308}
309
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000310table FloorLayer{
311 base:LayerBase;
312}
313
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000314table FullyConnectedLayer {
315 base:LayerBase;
316 descriptor:FullyConnectedDescriptor;
317 weights:ConstTensor;
318 biases:ConstTensor;
319}
320
321table FullyConnectedDescriptor {
322 biasEnabled:bool = false;
323 transposeWeightsMatrix:bool = false;
324}
325
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000326table GatherLayer {
327 base:LayerBase;
Teresa Charlin52664732020-06-29 16:27:03 +0100328 descriptor:GatherDescriptor;
329}
330
331table GatherDescriptor {
332 axis:int = 0;
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000333}
334
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100335/// @deprecated Use ComparisonLayer instead
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000336table GreaterLayer {
337 base:LayerBase;
338}
339
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000340table InputLayer {
341 base:BindableLayerBase;
342}
343
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100344table InstanceNormalizationLayer {
345 base:LayerBase;
346 descriptor:InstanceNormalizationDescriptor;
347}
348
349table InstanceNormalizationDescriptor {
350 gamma:float;
351 beta:float;
352 eps:float;
353 dataLayout:DataLayout;
354}
355
Sadik Armagan26257852019-10-14 13:00:47 +0100356table LogSoftmaxLayer {
357 base:LayerBase;
358 descriptor:LogSoftmaxDescriptor;
359}
360
361table LogSoftmaxDescriptor {
362 beta:float = 1;
363 axis:int = -1;
364}
365
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000366table L2NormalizationLayer {
367 base:LayerBase;
368 descriptor:L2NormalizationDescriptor;
369}
370
371table L2NormalizationDescriptor {
372 dataLayout:DataLayout = NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100373 eps:float = 1e-12;
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000374}
375
James Conroyaba90cd2020-11-06 16:28:18 +0000376enum LogicalBinaryOperation : byte {
377 LogicalAnd = 0,
378 LogicalOr = 1
379}
380
381table LogicalBinaryDescriptor {
382 operation:LogicalBinaryOperation;
383}
384
385table LogicalBinaryLayer {
386 base:LayerBase;
387 descriptor:LogicalBinaryDescriptor;
388}
389
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000390table MinimumLayer {
391 base:LayerBase;
392}
393
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000394table MaximumLayer {
395 base:LayerBase;
396}
397
Sadik Armagan5f450272019-02-12 14:31:45 +0000398table MultiplicationLayer {
399 base:LayerBase;
400}
401
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000402table Pooling2dLayer {
403 base:LayerBase;
404 descriptor:Pooling2dDescriptor;
405}
406
407enum PoolingAlgorithm : byte {
408 Max = 0,
409 Average = 1,
410 L2 = 2
411}
412
413enum OutputShapeRounding : byte {
414 Floor = 0,
415 Ceiling = 1
416}
417
418enum PaddingMethod : byte {
419 IgnoreValue = 0,
420 Exclude = 1
421}
422
423table Pooling2dDescriptor {
424 poolType:PoolingAlgorithm;
425 padLeft:uint;
426 padRight:uint;
427 padTop:uint;
428 padBottom:uint;
429 poolWidth:uint;
430 poolHeight:uint;
431 strideX:uint;
432 strideY:uint;
433 outputShapeRounding:OutputShapeRounding;
434 paddingMethod:PaddingMethod;
435 dataLayout:DataLayout;
436}
437
Derek Lamberti87acb272019-03-27 16:51:31 +0000438table QuantizeLayer {
439 base:LayerBase;
440}
441
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000442table SoftmaxLayer {
443 base:LayerBase;
444 descriptor:SoftmaxDescriptor;
445}
446
447table SoftmaxDescriptor {
448 beta:float;
449}
450
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000451table DepthwiseConvolution2dLayer {
452 base:LayerBase;
453 descriptor:DepthwiseConvolution2dDescriptor;
454 weights:ConstTensor;
455 biases:ConstTensor;
456}
457
458table DepthwiseConvolution2dDescriptor {
459 padLeft:uint;
460 padRight:uint;
461 padTop:uint;
462 padBottom:uint;
463 strideX:uint;
464 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100465 dilationX:uint = 1;
466 dilationY:uint = 1;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000467 biasEnabled:bool = false;
468 dataLayout:DataLayout = NCHW;
469}
470
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000471table OutputLayer {
472 base:BindableLayerBase;
473}
474
Saoirse Stewart263829c2019-02-19 15:54:14 +0000475table ReshapeLayer {
476 base:LayerBase;
477 descriptor:ReshapeDescriptor;
478}
479
480table ReshapeDescriptor {
481 targetShape:[uint];
482}
483
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000484table PermuteLayer {
485 base:LayerBase;
486 descriptor:PermuteDescriptor;
487}
488
489table PermuteDescriptor {
490 dimMappings:[uint];
491}
492
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000493table SpaceToBatchNdLayer {
494 base:LayerBase;
495 descriptor:SpaceToBatchNdDescriptor;
496}
497
498table SpaceToBatchNdDescriptor {
499 blockShape:[uint];
500 padList:[uint];
501 dataLayout:DataLayout;
502}
503
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100504table SpaceToDepthLayer {
505 base:LayerBase;
506 descriptor:SpaceToDepthDescriptor;
507}
508
509table SpaceToDepthDescriptor {
510 blockSize:uint;
511 dataLayout:DataLayout;
512}
513
Conor Kennedyda1f9752019-03-01 14:37:12 +0000514table SubtractionLayer {
515 base:LayerBase;
516}
517
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000518table BatchToSpaceNdLayer {
519 base:LayerBase;
520 descriptor:BatchToSpaceNdDescriptor;
521}
522
523table BatchToSpaceNdDescriptor {
524 blockShape:[uint];
525 crops:[uint];
526 dataLayout:DataLayout;
527}
528
Nina Drozd57728782019-02-27 10:53:27 +0000529enum NormalizationAlgorithmChannel : byte {
530 Across = 0,
531 Within = 1
532}
533
534enum NormalizationAlgorithmMethod : byte {
535 LocalBrightness = 0,
536 LocalContrast = 1
537}
538
539table NormalizationLayer {
540 base:LayerBase;
541 descriptor:NormalizationDescriptor;
542}
543
544table NormalizationDescriptor {
545 normChannelType:NormalizationAlgorithmChannel = Across;
546 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
547 normSize:uint;
548 alpha:float;
549 beta:float;
550 k:float;
551 dataLayout:DataLayout = NCHW;
552}
553
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000554table MeanLayer {
555 base:LayerBase;
556 descriptor:MeanDescriptor;
557}
558
559table MeanDescriptor {
560 axis:[uint];
561 keepDims:bool = false;
562}
563
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000564table PadLayer {
565 base:LayerBase;
566 descriptor:PadDescriptor;
567}
568
569table PadDescriptor {
570 padList:[uint];
David Monahan34757812019-06-19 11:47:21 +0100571 padValue:float = 0;
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000572}
573
josh minor4a3c6102020-01-06 16:40:46 -0600574/// @deprecated Use ElementwiseUnaryLayer instead
Sadik Armagan8b42a382019-03-01 14:24:49 +0000575table RsqrtLayer {
576 base:LayerBase;
577}
578
ruoyan018e7fa232019-02-28 15:09:07 +0000579table BatchNormalizationLayer {
580 base:LayerBase;
581 descriptor:BatchNormalizationDescriptor;
582 mean:ConstTensor;
583 variance:ConstTensor;
584 beta:ConstTensor;
585 gamma:ConstTensor;
586}
587
588table BatchNormalizationDescriptor {
589 eps:float;
590 dataLayout:DataLayout;
591}
592
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100593/// @deprecated Use ResizeLayer instead
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000594table ResizeBilinearLayer {
595 base:LayerBase;
596 descriptor:ResizeBilinearDescriptor;
597}
598
599table ResizeBilinearDescriptor {
600 targetWidth:uint;
601 targetHeight:uint;
602 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100603 alignCorners:bool;
604 halfPixelCenters:bool;
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000605}
606
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100607table SliceLayer {
608 base:LayerBase;
609 descriptor:SliceDescriptor;
610}
611
612table SliceDescriptor {
613 begin:[uint];
614 size:[uint];
615}
616
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000617table StridedSliceLayer {
618 base:LayerBase;
619 descriptor:StridedSliceDescriptor;
620}
621
622table StridedSliceDescriptor {
623 begin:[int];
624 end:[int];
625 stride:[int];
626 beginMask:int;
627 endMask:int;
628 shrinkAxisMask:int;
629 ellipsisMask:int;
630 newAxisMask:int;
631 dataLayout:DataLayout;
632}
633
Jim Flynne242f2d2019-05-22 14:24:13 +0100634table ConcatLayer {
635 base:LayerBase;
636 descriptor:OriginsDescriptor;
637}
638
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100639/// @deprecated Use ConcatLayer instead
Jim Flynnac25a1b2019-02-28 10:40:49 +0000640table MergerLayer {
641 base:LayerBase;
642 descriptor:OriginsDescriptor;
643}
644
645table UintVector {
646 data:[uint];
647}
648
649table OriginsDescriptor {
650 concatAxis:uint;
651 numViews:uint;
652 numDimensions:uint;
653 viewOrigins:[UintVector];
654}
655
Jim Flynn18ce3382019-03-08 11:08:30 +0000656table ViewsDescriptor {
657 origins:OriginsDescriptor;
658 viewSizes:[UintVector];
659}
660
661table SplitterLayer {
662 base:LayerBase;
663 descriptor:ViewsDescriptor;
664}
665
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000666table DetectionPostProcessLayer {
667 base:LayerBase;
668 descriptor:DetectionPostProcessDescriptor;
669 anchors:ConstTensor;
670}
671
672table DetectionPostProcessDescriptor {
673 maxDetections:uint;
674 maxClassesPerDetection:uint;
675 detectionsPerClass:uint;
676 nmsScoreThreshold:float;
677 nmsIouThreshold:float;
678 numClasses:uint;
679 useRegularNms:bool;
680 scaleX:float;
681 scaleY:float;
682 scaleW:float;
683 scaleH:float;
684}
685
Jim Flynn11af3752019-03-19 17:22:29 +0000686table LstmInputParams {
687 inputToForgetWeights:ConstTensor;
688 inputToCellWeights:ConstTensor;
689 inputToOutputWeights:ConstTensor;
690 recurrentToForgetWeights:ConstTensor;
691 recurrentToCellWeights:ConstTensor;
692 recurrentToOutputWeights:ConstTensor;
693 forgetGateBias:ConstTensor;
694 cellBias:ConstTensor;
695 outputGateBias:ConstTensor;
696
697 inputToInputWeights:ConstTensor;
698 recurrentToInputWeights:ConstTensor;
699 cellToInputWeights:ConstTensor;
700 inputGateBias:ConstTensor;
701
702 projectionWeights:ConstTensor;
703 projectionBias:ConstTensor;
704
705 cellToForgetWeights:ConstTensor;
706 cellToOutputWeights:ConstTensor;
Jan Eilersf8c62972019-07-17 11:07:49 +0100707
708 inputLayerNormWeights:ConstTensor;
709 forgetLayerNormWeights:ConstTensor;
710 cellLayerNormWeights:ConstTensor;
711 outputLayerNormWeights:ConstTensor;
Jim Flynn11af3752019-03-19 17:22:29 +0000712}
713
James Conroy8d333182020-05-13 10:27:58 +0100714table LstmDescriptor {
715 activationFunc:uint;
716 clippingThresCell:float;
717 clippingThresProj:float;
718 cifgEnabled:bool = true;
719 peepholeEnabled:bool = false;
720 projectionEnabled:bool = false;
721 layerNormEnabled:bool = false;
722}
723
724table LstmLayer {
725 base:LayerBase;
726 descriptor:LstmDescriptor;
727 inputParams:LstmInputParams;
728}
729
730table QLstmInputParams {
731 // Mandatory
732 inputToForgetWeights:ConstTensor;
733 inputToCellWeights:ConstTensor;
734 inputToOutputWeights:ConstTensor;
735
736 recurrentToForgetWeights:ConstTensor;
737 recurrentToCellWeights:ConstTensor;
738 recurrentToOutputWeights:ConstTensor;
739
740 forgetGateBias:ConstTensor;
741 cellBias:ConstTensor;
742 outputGateBias:ConstTensor;
743
744 // CIFG
745 inputToInputWeights:ConstTensor;
746 recurrentToInputWeights:ConstTensor;
747 inputGateBias:ConstTensor;
748
749 // Projection
750 projectionWeights:ConstTensor;
751 projectionBias:ConstTensor;
752
753 // Peephole
754 cellToInputWeights:ConstTensor;
755 cellToForgetWeights:ConstTensor;
756 cellToOutputWeights:ConstTensor;
757
758 // Layer norm
759 inputLayerNormWeights:ConstTensor;
760 forgetLayerNormWeights:ConstTensor;
761 cellLayerNormWeights:ConstTensor;
762 outputLayerNormWeights:ConstTensor;
763}
764
765table QLstmDescriptor {
766 cifgEnabled:bool = true;
767 peepholeEnabled:bool = false;
768 projectionEnabled:bool = false;
769 layerNormEnabled:bool = false;
770
771 cellClip:float;
772 projectionClip:float;
773
774 inputIntermediateScale:float;
775 forgetIntermediateScale:float;
776 cellIntermediateScale:float;
777 outputIntermediateScale:float;
778
779 hiddenStateZeroPoint:int;
780 hiddenStateScale:float;
781}
782
783table QLstmLayer {
784 base:LayerBase;
785 descriptor:QLstmDescriptor;
786 inputParams:QLstmInputParams;
787}
788
Jan Eilers5b01a892019-07-23 09:47:43 +0100789table QuantizedLstmInputParams {
790 inputToInputWeights:ConstTensor;
791 inputToForgetWeights:ConstTensor;
792 inputToCellWeights:ConstTensor;
793 inputToOutputWeights:ConstTensor;
794
795 recurrentToInputWeights:ConstTensor;
796 recurrentToForgetWeights:ConstTensor;
797 recurrentToCellWeights:ConstTensor;
798 recurrentToOutputWeights:ConstTensor;
799
800 inputGateBias:ConstTensor;
801 forgetGateBias:ConstTensor;
802 cellBias:ConstTensor;
803 outputGateBias:ConstTensor;
804}
805
Jan Eilers5b01a892019-07-23 09:47:43 +0100806table QuantizedLstmLayer {
807 base:LayerBase;
808 inputParams:QuantizedLstmInputParams;
809}
810
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000811table DequantizeLayer {
812 base:LayerBase;
813}
814
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100815table MergeLayer {
816 base:LayerBase;
817}
818
Sadik Armaganeff363d2019-04-05 15:25:46 +0100819table SwitchLayer {
820 base:LayerBase;
821}
822
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100823table PreluLayer {
824 base:LayerBase;
825}
826
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100827table TransposeConvolution2dLayer {
828 base:LayerBase;
829 descriptor:TransposeConvolution2dDescriptor;
830 weights:ConstTensor;
831 biases:ConstTensor;
832}
833
834table TransposeConvolution2dDescriptor {
835 padLeft:uint;
836 padRight:uint;
837 padTop:uint;
838 padBottom:uint;
839 strideX:uint;
840 strideY:uint;
841 biasEnabled:bool = false;
842 dataLayout:DataLayout = NCHW;
843}
844
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000845table TransposeLayer {
846 base:LayerBase;
847 descriptor:TransposeDescriptor;
848}
849
850table TransposeDescriptor {
851 dimMappings:[uint];
852}
853
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100854table ResizeLayer {
855 base:LayerBase;
856 descriptor:ResizeDescriptor;
857}
858
859table ResizeDescriptor {
860 targetHeight:uint;
861 targetWidth:uint;
862 method:ResizeMethod = NearestNeighbor;
863 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100864 alignCorners:bool;
865 halfPixelCenters:bool;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100866}
867
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100868table StackLayer {
869 base:LayerBase;
870 descriptor:StackDescriptor;
871}
872
873table StackDescriptor {
874 axis:uint;
875 numInputs:uint;
876 inputShape:[uint];
877}
878
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100879table StandInDescriptor {
880 numInputs:uint;
881 numOutputs:uint;
882}
883
884table StandInLayer {
885 base:LayerBase;
886 descriptor:StandInDescriptor;
887}
888
Finn Williams2605b232020-06-10 15:53:46 +0100889table RankLayer {
890 base:LayerBase;
891}
892
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000893table ReduceLayer {
894 base:LayerBase;
895 descriptor:ReduceDescriptor;
896}
897
898table ReduceDescriptor {
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000899 keepDims:bool = false;
900 axis:[uint];
901 reduceOperation:ReduceOperation = Sum;
902}
903
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000904union Layer {
Mike Kellyaf484012019-02-20 16:53:11 +0000905 ActivationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000906 AdditionLayer,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000907 BatchToSpaceNdLayer,
ruoyan018e7fa232019-02-28 15:09:07 +0000908 BatchNormalizationLayer,
Conor Kennedy76277882019-02-26 08:29:54 +0000909 ConstantLayer,
Mike Kellya0766c32019-02-19 17:22:07 +0000910 Convolution2dLayer,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000911 DepthwiseConvolution2dLayer,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000912 FullyConnectedLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000913 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +0000914 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000915 OutputLayer,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000916 PermuteLayer,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000917 Pooling2dLayer,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000918 ReshapeLayer,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000919 SoftmaxLayer,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000920 SpaceToBatchNdLayer,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000921 DivisionLayer,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000922 MinimumLayer,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000923 EqualLayer,
Nina Drozd57728782019-02-27 10:53:27 +0000924 MaximumLayer,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000925 NormalizationLayer,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000926 PadLayer,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000927 RsqrtLayer,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000928 FloorLayer,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000929 GreaterLayer,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000930 ResizeBilinearLayer,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000931 SubtractionLayer,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000932 StridedSliceLayer,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000933 GatherLayer,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000934 MeanLayer,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000935 MergerLayer,
Jim Flynn18ce3382019-03-08 11:08:30 +0000936 L2NormalizationLayer,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000937 SplitterLayer,
Jim Flynn11af3752019-03-19 17:22:29 +0000938 DetectionPostProcessLayer,
Derek Lamberti87acb272019-03-27 16:51:31 +0000939 LstmLayer,
Jan Eilers5b01a892019-07-23 09:47:43 +0100940 QuantizedLstmLayer,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000941 QuantizeLayer,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100942 DequantizeLayer,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100943 MergeLayer,
Jim Flynne242f2d2019-05-22 14:24:13 +0100944 SwitchLayer,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100945 ConcatLayer,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100946 SpaceToDepthLayer,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100947 PreluLayer,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100948 TransposeConvolution2dLayer,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100949 ResizeLayer,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100950 StackLayer,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100951 AbsLayer,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100952 ArgMinMaxLayer,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100953 SliceLayer,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100954 DepthToSpaceLayer,
Sadik Armagan26257852019-10-14 13:00:47 +0100955 InstanceNormalizationLayer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100956 LogSoftmaxLayer,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100957 ComparisonLayer,
josh minor4a3c6102020-01-06 16:40:46 -0600958 StandInLayer,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000959 ElementwiseUnaryLayer,
James Conroy8d333182020-05-13 10:27:58 +0100960 TransposeLayer,
Keith Davis300ad562020-06-04 16:34:23 +0100961 QLstmLayer,
Finn Williams2605b232020-06-10 15:53:46 +0100962 FillLayer,
James Conroyaba90cd2020-11-06 16:28:18 +0000963 RankLayer,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000964 LogicalBinaryLayer,
965 ReduceLayer
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000966}
967
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000968table AnyLayer {
969 layer:Layer;
970}
971
Tee Jungaa920c52019-11-05 10:48:25 +0000972table FeatureCompatibilityVersions {
973 bindingIdsScheme:uint = 0;
974}
975
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000976// Root type for serialized data is the graph of the network
977table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000978 layers:[AnyLayer];
Tee Jungaa920c52019-11-05 10:48:25 +0000979 inputIds:[int];
980 outputIds:[int];
981 featureVersions:FeatureCompatibilityVersions;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000982}
983
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000984root_type SerializedGraph;