blob: aa539b188fe07b17e51d90ef8839944ce57b4588 [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;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000070}
71
72struct Connection {
73 sourceLayerIndex:uint;
74 outputSlotIndex:uint;
75}
76
77table ByteData {
78 data:[byte];
79}
80
81table ShortData {
82 data:[short];
83}
84
85table IntData {
86 data:[int];
87}
88
89table LongData {
90 data:[long];
91}
92
93union ConstTensorData { ByteData, ShortData, IntData, LongData }
94
95table ConstTensor {
96 info:TensorInfo;
97 data:ConstTensorData;
98}
99
100table InputSlot {
101 index:uint;
102 connection:Connection;
103}
104
105table OutputSlot {
106 index:uint;
107 tensorInfo:TensorInfo;
108}
109
110enum LayerType : uint {
111 Addition = 0,
112 Input = 1,
Sadik Armagan5f450272019-02-12 14:31:45 +0000113 Multiplication = 2,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000114 Output = 3,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000115 Pooling2d = 4,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000116 Reshape = 5,
Mike Kellya0766c32019-02-19 17:22:07 +0000117 Softmax = 6,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000118 Convolution2d = 7,
Mike Kellyaf484012019-02-20 16:53:11 +0000119 DepthwiseConvolution2d = 8,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000120 Activation = 9,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000121 Permute = 10,
Conor Kennedy76277882019-02-26 08:29:54 +0000122 FullyConnected = 11,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000123 Constant = 12,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000124 SpaceToBatchNd = 13,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000125 BatchToSpaceNd = 14,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000126 Division = 15,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000127 Minimum = 16,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000128 Equal = 17,
Nina Drozd57728782019-02-27 10:53:27 +0000129 Maximum = 18,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000130 Normalization = 19,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000131 Pad = 20,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000132 Rsqrt = 21,
ruoyan018e7fa232019-02-28 15:09:07 +0000133 Floor = 22,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000134 BatchNormalization = 23,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000135 Greater = 24,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000136 ResizeBilinear = 25,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000137 Subtraction = 26,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000138 StridedSlice = 27,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000139 Gather = 28,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000140 Mean = 29,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000141 Merger = 30,
Jim Flynn18ce3382019-03-08 11:08:30 +0000142 L2Normalization = 31,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000143 Splitter = 32,
Jim Flynn11af3752019-03-19 17:22:29 +0000144 DetectionPostProcess = 33,
Derek Lamberti87acb272019-03-27 16:51:31 +0000145 Lstm = 34,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000146 Quantize = 35,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100147 Dequantize = 36,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100148 Merge = 37,
Jim Flynne242f2d2019-05-22 14:24:13 +0100149 Switch = 38,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100150 Concat = 39,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100151 SpaceToDepth = 40,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100152 Prelu = 41,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100153 TransposeConvolution2d = 42,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100154 Resize = 43,
Jan Eilers5b01a892019-07-23 09:47:43 +0100155 Stack = 44,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100156 QuantizedLstm = 45,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100157 Abs = 46,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100158 ArgMinMax = 47,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100159 Slice = 48,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100160 DepthToSpace = 49,
Sadik Armagan26257852019-10-14 13:00:47 +0100161 InstanceNormalization = 50,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100162 LogSoftmax = 51,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100163 Comparison = 52,
josh minor4a3c6102020-01-06 16:40:46 -0600164 StandIn = 53,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000165 ElementwiseUnary = 54,
James Conroy8d333182020-05-13 10:27:58 +0100166 Transpose = 55,
Keith Davis300ad562020-06-04 16:34:23 +0100167 QLstm = 56,
Finn Williams2605b232020-06-10 15:53:46 +0100168 Fill = 57,
James Conroyaba90cd2020-11-06 16:28:18 +0000169 Rank = 58,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000170 LogicalBinary = 59,
171 Reduce = 60
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000172}
173
174// Base layer table to be used as part of other layers
175table LayerBase {
176 index:uint;
177 layerName:string;
178 layerType:LayerType;
179 inputSlots:[InputSlot];
180 outputSlots:[OutputSlot];
181}
182
183table BindableLayerBase {
184 base:LayerBase;
185 layerBindingId:int;
186}
187
188// Table for each layer defined below
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100189
josh minor4a3c6102020-01-06 16:40:46 -0600190/// @deprecated Use ElementwiseUnaryLayer instead
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100191table AbsLayer {
192 base:LayerBase;
193}
194
Mike Kellyaf484012019-02-20 16:53:11 +0000195table ActivationLayer {
196 base:LayerBase;
197 descriptor:ActivationDescriptor;
198}
199
200table ActivationDescriptor {
Tee Jung86bc3d82019-10-01 11:25:56 +0900201 activationFunction:ActivationFunction = Sigmoid;
Mike Kellyaf484012019-02-20 16:53:11 +0000202 a:float;
203 b:float;
204}
205
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000206table AdditionLayer {
207 base:LayerBase;
208}
209
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100210table ArgMinMaxLayer {
211 base:LayerBase;
212 descriptor:ArgMinMaxDescriptor;
213}
214
215table ArgMinMaxDescriptor{
Tee Jung86bc3d82019-10-01 11:25:56 +0900216 argMinMaxFunction:ArgMinMaxFunction;
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100217 axis:int;
218}
219
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100220enum ComparisonOperation : byte {
221 Equal = 0,
222 Greater = 1,
223 GreaterOrEqual = 2,
224 Less = 3,
225 LessOrEqual = 4,
226 NotEqual = 5
227}
228
229table ComparisonDescriptor {
230 operation:ComparisonOperation;
231}
232
233table ComparisonLayer {
234 base:LayerBase;
235 descriptor:ComparisonDescriptor;
236}
237
Conor Kennedy76277882019-02-26 08:29:54 +0000238table ConstantLayer {
239 base:LayerBase;
240 input:ConstTensor;
241}
242
Mike Kellya0766c32019-02-19 17:22:07 +0000243table Convolution2dLayer {
244 base:LayerBase;
245 descriptor:Convolution2dDescriptor;
246 weights:ConstTensor;
247 biases:ConstTensor;
248}
249
250table Convolution2dDescriptor {
251 padLeft:uint;
252 padRight:uint;
253 padTop:uint;
254 padBottom:uint;
255 strideX:uint;
256 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100257 dilationX:uint = 1;
258 dilationY:uint = 1;
Mike Kellya0766c32019-02-19 17:22:07 +0000259 biasEnabled:bool = false;
260 dataLayout:DataLayout = NCHW;
261}
262
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100263table DepthToSpaceLayer {
264 base:LayerBase;
265 descriptor:DepthToSpaceDescriptor;
266}
267
268table DepthToSpaceDescriptor {
269 blockSize:uint;
270 dataLayout:DataLayout;
271}
272
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000273table DivisionLayer {
274 base:LayerBase;
275}
276
josh minor4a3c6102020-01-06 16:40:46 -0600277enum UnaryOperation : byte {
278 Abs = 0,
279 Rsqrt = 1,
280 Sqrt = 2,
281 Exp = 3,
James Conroyaba90cd2020-11-06 16:28:18 +0000282 Neg = 4,
283 LogicalNot = 5
josh minor4a3c6102020-01-06 16:40:46 -0600284}
285
286table ElementwiseUnaryDescriptor {
287 operation:UnaryOperation;
288}
289
290table ElementwiseUnaryLayer {
291 base:LayerBase;
292 descriptor:ElementwiseUnaryDescriptor;
293}
294
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100295/// @deprecated Use ComparisonLayer instead
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000296table EqualLayer {
297 base:LayerBase;
298}
299
Keith Davis300ad562020-06-04 16:34:23 +0100300table FillLayer {
301 base:LayerBase;
302 descriptor:FillDescriptor;
303}
304
305table FillDescriptor {
306 value:float;
307}
308
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000309table FloorLayer{
310 base:LayerBase;
311}
312
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000313table FullyConnectedLayer {
314 base:LayerBase;
315 descriptor:FullyConnectedDescriptor;
316 weights:ConstTensor;
317 biases:ConstTensor;
318}
319
320table FullyConnectedDescriptor {
321 biasEnabled:bool = false;
322 transposeWeightsMatrix:bool = false;
323}
324
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000325table GatherLayer {
326 base:LayerBase;
Teresa Charlin52664732020-06-29 16:27:03 +0100327 descriptor:GatherDescriptor;
328}
329
330table GatherDescriptor {
331 axis:int = 0;
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000332}
333
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100334/// @deprecated Use ComparisonLayer instead
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000335table GreaterLayer {
336 base:LayerBase;
337}
338
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000339table InputLayer {
340 base:BindableLayerBase;
341}
342
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100343table InstanceNormalizationLayer {
344 base:LayerBase;
345 descriptor:InstanceNormalizationDescriptor;
346}
347
348table InstanceNormalizationDescriptor {
349 gamma:float;
350 beta:float;
351 eps:float;
352 dataLayout:DataLayout;
353}
354
Sadik Armagan26257852019-10-14 13:00:47 +0100355table LogSoftmaxLayer {
356 base:LayerBase;
357 descriptor:LogSoftmaxDescriptor;
358}
359
360table LogSoftmaxDescriptor {
361 beta:float = 1;
362 axis:int = -1;
363}
364
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000365table L2NormalizationLayer {
366 base:LayerBase;
367 descriptor:L2NormalizationDescriptor;
368}
369
370table L2NormalizationDescriptor {
371 dataLayout:DataLayout = NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100372 eps:float = 1e-12;
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000373}
374
James Conroyaba90cd2020-11-06 16:28:18 +0000375enum LogicalBinaryOperation : byte {
376 LogicalAnd = 0,
377 LogicalOr = 1
378}
379
380table LogicalBinaryDescriptor {
381 operation:LogicalBinaryOperation;
382}
383
384table LogicalBinaryLayer {
385 base:LayerBase;
386 descriptor:LogicalBinaryDescriptor;
387}
388
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000389table MinimumLayer {
390 base:LayerBase;
391}
392
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000393table MaximumLayer {
394 base:LayerBase;
395}
396
Sadik Armagan5f450272019-02-12 14:31:45 +0000397table MultiplicationLayer {
398 base:LayerBase;
399}
400
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000401table Pooling2dLayer {
402 base:LayerBase;
403 descriptor:Pooling2dDescriptor;
404}
405
406enum PoolingAlgorithm : byte {
407 Max = 0,
408 Average = 1,
409 L2 = 2
410}
411
412enum OutputShapeRounding : byte {
413 Floor = 0,
414 Ceiling = 1
415}
416
417enum PaddingMethod : byte {
418 IgnoreValue = 0,
419 Exclude = 1
420}
421
422table Pooling2dDescriptor {
423 poolType:PoolingAlgorithm;
424 padLeft:uint;
425 padRight:uint;
426 padTop:uint;
427 padBottom:uint;
428 poolWidth:uint;
429 poolHeight:uint;
430 strideX:uint;
431 strideY:uint;
432 outputShapeRounding:OutputShapeRounding;
433 paddingMethod:PaddingMethod;
434 dataLayout:DataLayout;
435}
436
Derek Lamberti87acb272019-03-27 16:51:31 +0000437table QuantizeLayer {
438 base:LayerBase;
439}
440
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000441table SoftmaxLayer {
442 base:LayerBase;
443 descriptor:SoftmaxDescriptor;
444}
445
446table SoftmaxDescriptor {
447 beta:float;
448}
449
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000450table DepthwiseConvolution2dLayer {
451 base:LayerBase;
452 descriptor:DepthwiseConvolution2dDescriptor;
453 weights:ConstTensor;
454 biases:ConstTensor;
455}
456
457table DepthwiseConvolution2dDescriptor {
458 padLeft:uint;
459 padRight:uint;
460 padTop:uint;
461 padBottom:uint;
462 strideX:uint;
463 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100464 dilationX:uint = 1;
465 dilationY:uint = 1;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000466 biasEnabled:bool = false;
467 dataLayout:DataLayout = NCHW;
468}
469
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000470table OutputLayer {
471 base:BindableLayerBase;
472}
473
Saoirse Stewart263829c2019-02-19 15:54:14 +0000474table ReshapeLayer {
475 base:LayerBase;
476 descriptor:ReshapeDescriptor;
477}
478
479table ReshapeDescriptor {
480 targetShape:[uint];
481}
482
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000483table PermuteLayer {
484 base:LayerBase;
485 descriptor:PermuteDescriptor;
486}
487
488table PermuteDescriptor {
489 dimMappings:[uint];
490}
491
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000492table SpaceToBatchNdLayer {
493 base:LayerBase;
494 descriptor:SpaceToBatchNdDescriptor;
495}
496
497table SpaceToBatchNdDescriptor {
498 blockShape:[uint];
499 padList:[uint];
500 dataLayout:DataLayout;
501}
502
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100503table SpaceToDepthLayer {
504 base:LayerBase;
505 descriptor:SpaceToDepthDescriptor;
506}
507
508table SpaceToDepthDescriptor {
509 blockSize:uint;
510 dataLayout:DataLayout;
511}
512
Conor Kennedyda1f9752019-03-01 14:37:12 +0000513table SubtractionLayer {
514 base:LayerBase;
515}
516
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000517table BatchToSpaceNdLayer {
518 base:LayerBase;
519 descriptor:BatchToSpaceNdDescriptor;
520}
521
522table BatchToSpaceNdDescriptor {
523 blockShape:[uint];
524 crops:[uint];
525 dataLayout:DataLayout;
526}
527
Nina Drozd57728782019-02-27 10:53:27 +0000528enum NormalizationAlgorithmChannel : byte {
529 Across = 0,
530 Within = 1
531}
532
533enum NormalizationAlgorithmMethod : byte {
534 LocalBrightness = 0,
535 LocalContrast = 1
536}
537
538table NormalizationLayer {
539 base:LayerBase;
540 descriptor:NormalizationDescriptor;
541}
542
543table NormalizationDescriptor {
544 normChannelType:NormalizationAlgorithmChannel = Across;
545 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
546 normSize:uint;
547 alpha:float;
548 beta:float;
549 k:float;
550 dataLayout:DataLayout = NCHW;
551}
552
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000553table MeanLayer {
554 base:LayerBase;
555 descriptor:MeanDescriptor;
556}
557
558table MeanDescriptor {
559 axis:[uint];
560 keepDims:bool = false;
561}
562
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000563table PadLayer {
564 base:LayerBase;
565 descriptor:PadDescriptor;
566}
567
568table PadDescriptor {
569 padList:[uint];
David Monahan34757812019-06-19 11:47:21 +0100570 padValue:float = 0;
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000571}
572
josh minor4a3c6102020-01-06 16:40:46 -0600573/// @deprecated Use ElementwiseUnaryLayer instead
Sadik Armagan8b42a382019-03-01 14:24:49 +0000574table RsqrtLayer {
575 base:LayerBase;
576}
577
ruoyan018e7fa232019-02-28 15:09:07 +0000578table BatchNormalizationLayer {
579 base:LayerBase;
580 descriptor:BatchNormalizationDescriptor;
581 mean:ConstTensor;
582 variance:ConstTensor;
583 beta:ConstTensor;
584 gamma:ConstTensor;
585}
586
587table BatchNormalizationDescriptor {
588 eps:float;
589 dataLayout:DataLayout;
590}
591
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100592/// @deprecated Use ResizeLayer instead
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000593table ResizeBilinearLayer {
594 base:LayerBase;
595 descriptor:ResizeBilinearDescriptor;
596}
597
598table ResizeBilinearDescriptor {
599 targetWidth:uint;
600 targetHeight:uint;
601 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100602 alignCorners:bool;
603 halfPixelCenters:bool;
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000604}
605
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100606table SliceLayer {
607 base:LayerBase;
608 descriptor:SliceDescriptor;
609}
610
611table SliceDescriptor {
612 begin:[uint];
613 size:[uint];
614}
615
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000616table StridedSliceLayer {
617 base:LayerBase;
618 descriptor:StridedSliceDescriptor;
619}
620
621table StridedSliceDescriptor {
622 begin:[int];
623 end:[int];
624 stride:[int];
625 beginMask:int;
626 endMask:int;
627 shrinkAxisMask:int;
628 ellipsisMask:int;
629 newAxisMask:int;
630 dataLayout:DataLayout;
631}
632
Jim Flynne242f2d2019-05-22 14:24:13 +0100633table ConcatLayer {
634 base:LayerBase;
635 descriptor:OriginsDescriptor;
636}
637
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100638/// @deprecated Use ConcatLayer instead
Jim Flynnac25a1b2019-02-28 10:40:49 +0000639table MergerLayer {
640 base:LayerBase;
641 descriptor:OriginsDescriptor;
642}
643
644table UintVector {
645 data:[uint];
646}
647
648table OriginsDescriptor {
649 concatAxis:uint;
650 numViews:uint;
651 numDimensions:uint;
652 viewOrigins:[UintVector];
653}
654
Jim Flynn18ce3382019-03-08 11:08:30 +0000655table ViewsDescriptor {
656 origins:OriginsDescriptor;
657 viewSizes:[UintVector];
658}
659
660table SplitterLayer {
661 base:LayerBase;
662 descriptor:ViewsDescriptor;
663}
664
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000665table DetectionPostProcessLayer {
666 base:LayerBase;
667 descriptor:DetectionPostProcessDescriptor;
668 anchors:ConstTensor;
669}
670
671table DetectionPostProcessDescriptor {
672 maxDetections:uint;
673 maxClassesPerDetection:uint;
674 detectionsPerClass:uint;
675 nmsScoreThreshold:float;
676 nmsIouThreshold:float;
677 numClasses:uint;
678 useRegularNms:bool;
679 scaleX:float;
680 scaleY:float;
681 scaleW:float;
682 scaleH:float;
683}
684
Jim Flynn11af3752019-03-19 17:22:29 +0000685table LstmInputParams {
686 inputToForgetWeights:ConstTensor;
687 inputToCellWeights:ConstTensor;
688 inputToOutputWeights:ConstTensor;
689 recurrentToForgetWeights:ConstTensor;
690 recurrentToCellWeights:ConstTensor;
691 recurrentToOutputWeights:ConstTensor;
692 forgetGateBias:ConstTensor;
693 cellBias:ConstTensor;
694 outputGateBias:ConstTensor;
695
696 inputToInputWeights:ConstTensor;
697 recurrentToInputWeights:ConstTensor;
698 cellToInputWeights:ConstTensor;
699 inputGateBias:ConstTensor;
700
701 projectionWeights:ConstTensor;
702 projectionBias:ConstTensor;
703
704 cellToForgetWeights:ConstTensor;
705 cellToOutputWeights:ConstTensor;
Jan Eilersf8c62972019-07-17 11:07:49 +0100706
707 inputLayerNormWeights:ConstTensor;
708 forgetLayerNormWeights:ConstTensor;
709 cellLayerNormWeights:ConstTensor;
710 outputLayerNormWeights:ConstTensor;
Jim Flynn11af3752019-03-19 17:22:29 +0000711}
712
James Conroy8d333182020-05-13 10:27:58 +0100713table LstmDescriptor {
714 activationFunc:uint;
715 clippingThresCell:float;
716 clippingThresProj:float;
717 cifgEnabled:bool = true;
718 peepholeEnabled:bool = false;
719 projectionEnabled:bool = false;
720 layerNormEnabled:bool = false;
721}
722
723table LstmLayer {
724 base:LayerBase;
725 descriptor:LstmDescriptor;
726 inputParams:LstmInputParams;
727}
728
729table QLstmInputParams {
730 // Mandatory
731 inputToForgetWeights:ConstTensor;
732 inputToCellWeights:ConstTensor;
733 inputToOutputWeights:ConstTensor;
734
735 recurrentToForgetWeights:ConstTensor;
736 recurrentToCellWeights:ConstTensor;
737 recurrentToOutputWeights:ConstTensor;
738
739 forgetGateBias:ConstTensor;
740 cellBias:ConstTensor;
741 outputGateBias:ConstTensor;
742
743 // CIFG
744 inputToInputWeights:ConstTensor;
745 recurrentToInputWeights:ConstTensor;
746 inputGateBias:ConstTensor;
747
748 // Projection
749 projectionWeights:ConstTensor;
750 projectionBias:ConstTensor;
751
752 // Peephole
753 cellToInputWeights:ConstTensor;
754 cellToForgetWeights:ConstTensor;
755 cellToOutputWeights:ConstTensor;
756
757 // Layer norm
758 inputLayerNormWeights:ConstTensor;
759 forgetLayerNormWeights:ConstTensor;
760 cellLayerNormWeights:ConstTensor;
761 outputLayerNormWeights:ConstTensor;
762}
763
764table QLstmDescriptor {
765 cifgEnabled:bool = true;
766 peepholeEnabled:bool = false;
767 projectionEnabled:bool = false;
768 layerNormEnabled:bool = false;
769
770 cellClip:float;
771 projectionClip:float;
772
773 inputIntermediateScale:float;
774 forgetIntermediateScale:float;
775 cellIntermediateScale:float;
776 outputIntermediateScale:float;
777
778 hiddenStateZeroPoint:int;
779 hiddenStateScale:float;
780}
781
782table QLstmLayer {
783 base:LayerBase;
784 descriptor:QLstmDescriptor;
785 inputParams:QLstmInputParams;
786}
787
Jan Eilers5b01a892019-07-23 09:47:43 +0100788table QuantizedLstmInputParams {
789 inputToInputWeights:ConstTensor;
790 inputToForgetWeights:ConstTensor;
791 inputToCellWeights:ConstTensor;
792 inputToOutputWeights:ConstTensor;
793
794 recurrentToInputWeights:ConstTensor;
795 recurrentToForgetWeights:ConstTensor;
796 recurrentToCellWeights:ConstTensor;
797 recurrentToOutputWeights:ConstTensor;
798
799 inputGateBias:ConstTensor;
800 forgetGateBias:ConstTensor;
801 cellBias:ConstTensor;
802 outputGateBias:ConstTensor;
803}
804
Jan Eilers5b01a892019-07-23 09:47:43 +0100805table QuantizedLstmLayer {
806 base:LayerBase;
807 inputParams:QuantizedLstmInputParams;
808}
809
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000810table DequantizeLayer {
811 base:LayerBase;
812}
813
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100814table MergeLayer {
815 base:LayerBase;
816}
817
Sadik Armaganeff363d2019-04-05 15:25:46 +0100818table SwitchLayer {
819 base:LayerBase;
820}
821
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100822table PreluLayer {
823 base:LayerBase;
824}
825
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100826table TransposeConvolution2dLayer {
827 base:LayerBase;
828 descriptor:TransposeConvolution2dDescriptor;
829 weights:ConstTensor;
830 biases:ConstTensor;
831}
832
833table TransposeConvolution2dDescriptor {
834 padLeft:uint;
835 padRight:uint;
836 padTop:uint;
837 padBottom:uint;
838 strideX:uint;
839 strideY:uint;
840 biasEnabled:bool = false;
841 dataLayout:DataLayout = NCHW;
842}
843
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000844table TransposeLayer {
845 base:LayerBase;
846 descriptor:TransposeDescriptor;
847}
848
849table TransposeDescriptor {
850 dimMappings:[uint];
851}
852
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100853table ResizeLayer {
854 base:LayerBase;
855 descriptor:ResizeDescriptor;
856}
857
858table ResizeDescriptor {
859 targetHeight:uint;
860 targetWidth:uint;
861 method:ResizeMethod = NearestNeighbor;
862 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100863 alignCorners:bool;
864 halfPixelCenters:bool;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100865}
866
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100867table StackLayer {
868 base:LayerBase;
869 descriptor:StackDescriptor;
870}
871
872table StackDescriptor {
873 axis:uint;
874 numInputs:uint;
875 inputShape:[uint];
876}
877
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100878table StandInDescriptor {
879 numInputs:uint;
880 numOutputs:uint;
881}
882
883table StandInLayer {
884 base:LayerBase;
885 descriptor:StandInDescriptor;
886}
887
Finn Williams2605b232020-06-10 15:53:46 +0100888table RankLayer {
889 base:LayerBase;
890}
891
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000892table ReduceLayer {
893 base:LayerBase;
894 descriptor:ReduceDescriptor;
895}
896
897table ReduceDescriptor {
898 targetHeight:uint;
899 targetWidth:uint;
900 keepDims:bool = false;
901 axis:[uint];
902 reduceOperation:ReduceOperation = Sum;
903}
904
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000905union Layer {
Mike Kellyaf484012019-02-20 16:53:11 +0000906 ActivationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000907 AdditionLayer,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000908 BatchToSpaceNdLayer,
ruoyan018e7fa232019-02-28 15:09:07 +0000909 BatchNormalizationLayer,
Conor Kennedy76277882019-02-26 08:29:54 +0000910 ConstantLayer,
Mike Kellya0766c32019-02-19 17:22:07 +0000911 Convolution2dLayer,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000912 DepthwiseConvolution2dLayer,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000913 FullyConnectedLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000914 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +0000915 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000916 OutputLayer,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000917 PermuteLayer,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000918 Pooling2dLayer,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000919 ReshapeLayer,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000920 SoftmaxLayer,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000921 SpaceToBatchNdLayer,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000922 DivisionLayer,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000923 MinimumLayer,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000924 EqualLayer,
Nina Drozd57728782019-02-27 10:53:27 +0000925 MaximumLayer,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000926 NormalizationLayer,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000927 PadLayer,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000928 RsqrtLayer,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000929 FloorLayer,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000930 GreaterLayer,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000931 ResizeBilinearLayer,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000932 SubtractionLayer,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000933 StridedSliceLayer,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000934 GatherLayer,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000935 MeanLayer,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000936 MergerLayer,
Jim Flynn18ce3382019-03-08 11:08:30 +0000937 L2NormalizationLayer,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000938 SplitterLayer,
Jim Flynn11af3752019-03-19 17:22:29 +0000939 DetectionPostProcessLayer,
Derek Lamberti87acb272019-03-27 16:51:31 +0000940 LstmLayer,
Jan Eilers5b01a892019-07-23 09:47:43 +0100941 QuantizedLstmLayer,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000942 QuantizeLayer,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100943 DequantizeLayer,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100944 MergeLayer,
Jim Flynne242f2d2019-05-22 14:24:13 +0100945 SwitchLayer,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100946 ConcatLayer,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100947 SpaceToDepthLayer,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100948 PreluLayer,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100949 TransposeConvolution2dLayer,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100950 ResizeLayer,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100951 StackLayer,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100952 AbsLayer,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100953 ArgMinMaxLayer,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100954 SliceLayer,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100955 DepthToSpaceLayer,
Sadik Armagan26257852019-10-14 13:00:47 +0100956 InstanceNormalizationLayer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100957 LogSoftmaxLayer,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100958 ComparisonLayer,
josh minor4a3c6102020-01-06 16:40:46 -0600959 StandInLayer,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000960 ElementwiseUnaryLayer,
James Conroy8d333182020-05-13 10:27:58 +0100961 TransposeLayer,
Keith Davis300ad562020-06-04 16:34:23 +0100962 QLstmLayer,
Finn Williams2605b232020-06-10 15:53:46 +0100963 FillLayer,
James Conroyaba90cd2020-11-06 16:28:18 +0000964 RankLayer,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000965 LogicalBinaryLayer,
966 ReduceLayer
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000967}
968
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000969table AnyLayer {
970 layer:Layer;
971}
972
Tee Jungaa920c52019-11-05 10:48:25 +0000973table FeatureCompatibilityVersions {
974 bindingIdsScheme:uint = 0;
975}
976
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000977// Root type for serialized data is the graph of the network
978table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000979 layers:[AnyLayer];
Tee Jungaa920c52019-11-05 10:48:25 +0000980 inputIds:[int];
981 outputIds:[int];
982 featureVersions:FeatureCompatibilityVersions;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000983}
984
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000985root_type SerializedGraph;