blob: 740090bcc811deeae16e930fbedce1bc76c78da6 [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,
Mike Kelly1f140f72021-04-06 12:25:55 +010042 QSymmS8 = 9,
43 Signed64 = 10
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000044}
45
Saoirse Stewart3166c3e2019-02-18 15:24:53 +000046enum DataLayout : byte {
47 NHWC = 0,
48 NCHW = 1
49}
50
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +000051enum ReduceOperation: byte {
52 Sum = 0,
53 Max = 1,
54 Mean = 2,
Teresa Charlin4e3e8312021-08-05 12:34:37 +010055 Min = 3,
56 Prod = 4
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +000057}
58
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +010059enum ResizeMethod: byte {
60 NearestNeighbor = 0,
61 Bilinear = 1,
62}
63
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000064table TensorInfo {
65 dimensions:[uint];
66 dataType:DataType;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000067 quantizationScale:float = 1.0; // @deprecated Use quantizationScales instead
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000068 quantizationOffset:int = 0;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000069 quantizationScales:[float];
70 quantizationDim:uint;
Finn Williams2605b232020-06-10 15:53:46 +010071 dimensionality:uint = 1;
Colm Donelan800b2812021-02-12 12:43:35 +000072 dimensionSpecificity:[bool];
Matthew Sloyan81beae32021-07-13 19:46:11 +010073 isConstant:bool = false;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000074}
75
76struct Connection {
77 sourceLayerIndex:uint;
78 outputSlotIndex:uint;
79}
80
81table ByteData {
82 data:[byte];
83}
84
85table ShortData {
86 data:[short];
87}
88
89table IntData {
90 data:[int];
91}
92
93table LongData {
94 data:[long];
95}
96
97union ConstTensorData { ByteData, ShortData, IntData, LongData }
98
99table ConstTensor {
100 info:TensorInfo;
101 data:ConstTensorData;
102}
103
104table InputSlot {
105 index:uint;
106 connection:Connection;
107}
108
109table OutputSlot {
110 index:uint;
111 tensorInfo:TensorInfo;
112}
113
114enum LayerType : uint {
115 Addition = 0,
116 Input = 1,
Sadik Armagan5f450272019-02-12 14:31:45 +0000117 Multiplication = 2,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000118 Output = 3,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000119 Pooling2d = 4,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000120 Reshape = 5,
Mike Kellya0766c32019-02-19 17:22:07 +0000121 Softmax = 6,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000122 Convolution2d = 7,
Mike Kellyaf484012019-02-20 16:53:11 +0000123 DepthwiseConvolution2d = 8,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000124 Activation = 9,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000125 Permute = 10,
Conor Kennedy76277882019-02-26 08:29:54 +0000126 FullyConnected = 11,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000127 Constant = 12,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000128 SpaceToBatchNd = 13,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000129 BatchToSpaceNd = 14,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000130 Division = 15,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000131 Minimum = 16,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000132 Equal = 17,
Nina Drozd57728782019-02-27 10:53:27 +0000133 Maximum = 18,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000134 Normalization = 19,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000135 Pad = 20,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000136 Rsqrt = 21,
ruoyan018e7fa232019-02-28 15:09:07 +0000137 Floor = 22,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000138 BatchNormalization = 23,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000139 Greater = 24,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000140 ResizeBilinear = 25,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000141 Subtraction = 26,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000142 StridedSlice = 27,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000143 Gather = 28,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000144 Mean = 29,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000145 Merger = 30,
Jim Flynn18ce3382019-03-08 11:08:30 +0000146 L2Normalization = 31,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000147 Splitter = 32,
Jim Flynn11af3752019-03-19 17:22:29 +0000148 DetectionPostProcess = 33,
Derek Lamberti87acb272019-03-27 16:51:31 +0000149 Lstm = 34,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000150 Quantize = 35,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100151 Dequantize = 36,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100152 Merge = 37,
Jim Flynne242f2d2019-05-22 14:24:13 +0100153 Switch = 38,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100154 Concat = 39,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100155 SpaceToDepth = 40,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100156 Prelu = 41,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100157 TransposeConvolution2d = 42,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100158 Resize = 43,
Jan Eilers5b01a892019-07-23 09:47:43 +0100159 Stack = 44,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100160 QuantizedLstm = 45,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100161 Abs = 46,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100162 ArgMinMax = 47,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100163 Slice = 48,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100164 DepthToSpace = 49,
Sadik Armagan26257852019-10-14 13:00:47 +0100165 InstanceNormalization = 50,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100166 LogSoftmax = 51,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100167 Comparison = 52,
josh minor4a3c6102020-01-06 16:40:46 -0600168 StandIn = 53,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000169 ElementwiseUnary = 54,
James Conroy8d333182020-05-13 10:27:58 +0100170 Transpose = 55,
Keith Davis300ad562020-06-04 16:34:23 +0100171 QLstm = 56,
Finn Williams2605b232020-06-10 15:53:46 +0100172 Fill = 57,
James Conroyaba90cd2020-11-06 16:28:18 +0000173 Rank = 58,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000174 LogicalBinary = 59,
mathad01b392e982021-04-07 12:07:30 +0100175 Reduce = 60,
Keith Davis3ae3f972021-05-21 16:33:48 +0100176 Cast = 61,
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100177 Shape = 62,
178 UnidirectionalSequenceLstm = 63,
Simon Obute51f67772021-09-03 15:50:13 +0100179 ChannelShuffle = 64,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000180}
181
182// Base layer table to be used as part of other layers
183table LayerBase {
184 index:uint;
185 layerName:string;
186 layerType:LayerType;
187 inputSlots:[InputSlot];
188 outputSlots:[OutputSlot];
189}
190
191table BindableLayerBase {
192 base:LayerBase;
193 layerBindingId:int;
194}
195
196// Table for each layer defined below
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100197
josh minor4a3c6102020-01-06 16:40:46 -0600198/// @deprecated Use ElementwiseUnaryLayer instead
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100199table AbsLayer {
200 base:LayerBase;
201}
202
Mike Kellyaf484012019-02-20 16:53:11 +0000203table ActivationLayer {
204 base:LayerBase;
205 descriptor:ActivationDescriptor;
206}
207
208table ActivationDescriptor {
Tee Jung86bc3d82019-10-01 11:25:56 +0900209 activationFunction:ActivationFunction = Sigmoid;
Mike Kellyaf484012019-02-20 16:53:11 +0000210 a:float;
211 b:float;
212}
213
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000214table AdditionLayer {
215 base:LayerBase;
216}
217
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100218table ArgMinMaxLayer {
219 base:LayerBase;
220 descriptor:ArgMinMaxDescriptor;
221}
222
223table ArgMinMaxDescriptor{
Tee Jung86bc3d82019-10-01 11:25:56 +0900224 argMinMaxFunction:ArgMinMaxFunction;
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100225 axis:int;
226}
227
mathad01b392e982021-04-07 12:07:30 +0100228table CastLayer {
229 base:LayerBase;
230}
231
Simon Obute51f67772021-09-03 15:50:13 +0100232table ChannelShuffleLayer {
233 base:LayerBase;
234 descriptor:ChannelShuffleDescriptor;
235}
236
237table ChannelShuffleDescriptor {
238 axis:uint = 0;
239 numGroups:uint = 0;
240}
241
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100242enum ComparisonOperation : byte {
243 Equal = 0,
244 Greater = 1,
245 GreaterOrEqual = 2,
246 Less = 3,
247 LessOrEqual = 4,
248 NotEqual = 5
249}
250
251table ComparisonDescriptor {
252 operation:ComparisonOperation;
253}
254
255table ComparisonLayer {
256 base:LayerBase;
257 descriptor:ComparisonDescriptor;
258}
259
Conor Kennedy76277882019-02-26 08:29:54 +0000260table ConstantLayer {
261 base:LayerBase;
262 input:ConstTensor;
263}
264
Mike Kellya0766c32019-02-19 17:22:07 +0000265table Convolution2dLayer {
266 base:LayerBase;
267 descriptor:Convolution2dDescriptor;
268 weights:ConstTensor;
269 biases:ConstTensor;
270}
271
272table Convolution2dDescriptor {
273 padLeft:uint;
274 padRight:uint;
275 padTop:uint;
276 padBottom:uint;
277 strideX:uint;
278 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100279 dilationX:uint = 1;
280 dilationY:uint = 1;
Mike Kellya0766c32019-02-19 17:22:07 +0000281 biasEnabled:bool = false;
282 dataLayout:DataLayout = NCHW;
283}
284
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100285table DepthToSpaceLayer {
286 base:LayerBase;
287 descriptor:DepthToSpaceDescriptor;
288}
289
290table DepthToSpaceDescriptor {
291 blockSize:uint;
292 dataLayout:DataLayout;
293}
294
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000295table DivisionLayer {
296 base:LayerBase;
297}
298
josh minor4a3c6102020-01-06 16:40:46 -0600299enum UnaryOperation : byte {
300 Abs = 0,
301 Rsqrt = 1,
302 Sqrt = 2,
303 Exp = 3,
James Conroyaba90cd2020-11-06 16:28:18 +0000304 Neg = 4,
Teresa Charlin50de4fa2021-05-31 18:47:33 +0100305 LogicalNot = 5,
306 Log = 6,
307 Sin = 7
josh minor4a3c6102020-01-06 16:40:46 -0600308}
309
310table ElementwiseUnaryDescriptor {
311 operation:UnaryOperation;
312}
313
314table ElementwiseUnaryLayer {
315 base:LayerBase;
316 descriptor:ElementwiseUnaryDescriptor;
317}
318
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100319/// @deprecated Use ComparisonLayer instead
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000320table EqualLayer {
321 base:LayerBase;
322}
323
Keith Davis300ad562020-06-04 16:34:23 +0100324table FillLayer {
325 base:LayerBase;
326 descriptor:FillDescriptor;
327}
328
329table FillDescriptor {
330 value:float;
331}
332
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000333table FloorLayer{
334 base:LayerBase;
335}
336
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000337table FullyConnectedLayer {
338 base:LayerBase;
339 descriptor:FullyConnectedDescriptor;
Matthew Sloyan81beae32021-07-13 19:46:11 +0100340 weights:ConstTensor; // ConstTensors are now passed as inputs.
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000341 biases:ConstTensor;
342}
343
344table FullyConnectedDescriptor {
345 biasEnabled:bool = false;
346 transposeWeightsMatrix:bool = false;
Sadik Armaganf0a6dec2021-03-25 07:46:55 +0000347 constantWeights:bool = true;
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000348}
349
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000350table GatherLayer {
351 base:LayerBase;
Teresa Charlin52664732020-06-29 16:27:03 +0100352 descriptor:GatherDescriptor;
353}
354
355table GatherDescriptor {
356 axis:int = 0;
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000357}
358
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100359/// @deprecated Use ComparisonLayer instead
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000360table GreaterLayer {
361 base:LayerBase;
362}
363
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000364table InputLayer {
365 base:BindableLayerBase;
366}
367
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100368table InstanceNormalizationLayer {
369 base:LayerBase;
370 descriptor:InstanceNormalizationDescriptor;
371}
372
373table InstanceNormalizationDescriptor {
374 gamma:float;
375 beta:float;
376 eps:float;
377 dataLayout:DataLayout;
378}
379
Sadik Armagan26257852019-10-14 13:00:47 +0100380table LogSoftmaxLayer {
381 base:LayerBase;
382 descriptor:LogSoftmaxDescriptor;
383}
384
385table LogSoftmaxDescriptor {
386 beta:float = 1;
387 axis:int = -1;
388}
389
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000390table L2NormalizationLayer {
391 base:LayerBase;
392 descriptor:L2NormalizationDescriptor;
393}
394
395table L2NormalizationDescriptor {
396 dataLayout:DataLayout = NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100397 eps:float = 1e-12;
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000398}
399
James Conroyaba90cd2020-11-06 16:28:18 +0000400enum LogicalBinaryOperation : byte {
401 LogicalAnd = 0,
402 LogicalOr = 1
403}
404
405table LogicalBinaryDescriptor {
406 operation:LogicalBinaryOperation;
407}
408
409table LogicalBinaryLayer {
410 base:LayerBase;
411 descriptor:LogicalBinaryDescriptor;
412}
413
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000414table MinimumLayer {
415 base:LayerBase;
416}
417
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000418table MaximumLayer {
419 base:LayerBase;
420}
421
Sadik Armagan5f450272019-02-12 14:31:45 +0000422table MultiplicationLayer {
423 base:LayerBase;
424}
425
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000426table Pooling2dLayer {
427 base:LayerBase;
428 descriptor:Pooling2dDescriptor;
429}
430
431enum PoolingAlgorithm : byte {
432 Max = 0,
433 Average = 1,
434 L2 = 2
435}
436
437enum OutputShapeRounding : byte {
438 Floor = 0,
439 Ceiling = 1
440}
441
442enum PaddingMethod : byte {
443 IgnoreValue = 0,
444 Exclude = 1
445}
446
447table Pooling2dDescriptor {
448 poolType:PoolingAlgorithm;
449 padLeft:uint;
450 padRight:uint;
451 padTop:uint;
452 padBottom:uint;
453 poolWidth:uint;
454 poolHeight:uint;
455 strideX:uint;
456 strideY:uint;
457 outputShapeRounding:OutputShapeRounding;
458 paddingMethod:PaddingMethod;
459 dataLayout:DataLayout;
460}
461
Derek Lamberti87acb272019-03-27 16:51:31 +0000462table QuantizeLayer {
463 base:LayerBase;
464}
465
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000466table SoftmaxLayer {
467 base:LayerBase;
468 descriptor:SoftmaxDescriptor;
469}
470
471table SoftmaxDescriptor {
472 beta:float;
473}
474
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000475table DepthwiseConvolution2dLayer {
476 base:LayerBase;
477 descriptor:DepthwiseConvolution2dDescriptor;
478 weights:ConstTensor;
479 biases:ConstTensor;
480}
481
482table DepthwiseConvolution2dDescriptor {
483 padLeft:uint;
484 padRight:uint;
485 padTop:uint;
486 padBottom:uint;
487 strideX:uint;
488 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100489 dilationX:uint = 1;
490 dilationY:uint = 1;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000491 biasEnabled:bool = false;
492 dataLayout:DataLayout = NCHW;
493}
494
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000495table OutputLayer {
496 base:BindableLayerBase;
497}
498
Saoirse Stewart263829c2019-02-19 15:54:14 +0000499table ReshapeLayer {
500 base:LayerBase;
501 descriptor:ReshapeDescriptor;
502}
503
504table ReshapeDescriptor {
Keith Davis3ae3f972021-05-21 16:33:48 +0100505 targetShape:[uint];
Saoirse Stewart263829c2019-02-19 15:54:14 +0000506}
507
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000508table PermuteLayer {
509 base:LayerBase;
510 descriptor:PermuteDescriptor;
511}
512
513table PermuteDescriptor {
514 dimMappings:[uint];
515}
516
Keith Davis3ae3f972021-05-21 16:33:48 +0100517table ShapeLayer {
518 base:LayerBase;
519}
520
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000521table SpaceToBatchNdLayer {
522 base:LayerBase;
523 descriptor:SpaceToBatchNdDescriptor;
524}
525
526table SpaceToBatchNdDescriptor {
527 blockShape:[uint];
528 padList:[uint];
529 dataLayout:DataLayout;
530}
531
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100532table SpaceToDepthLayer {
533 base:LayerBase;
534 descriptor:SpaceToDepthDescriptor;
535}
536
537table SpaceToDepthDescriptor {
538 blockSize:uint;
539 dataLayout:DataLayout;
540}
541
Conor Kennedyda1f9752019-03-01 14:37:12 +0000542table SubtractionLayer {
543 base:LayerBase;
544}
545
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000546table BatchToSpaceNdLayer {
547 base:LayerBase;
548 descriptor:BatchToSpaceNdDescriptor;
549}
550
551table BatchToSpaceNdDescriptor {
552 blockShape:[uint];
553 crops:[uint];
554 dataLayout:DataLayout;
555}
556
Nina Drozd57728782019-02-27 10:53:27 +0000557enum NormalizationAlgorithmChannel : byte {
558 Across = 0,
559 Within = 1
560}
561
562enum NormalizationAlgorithmMethod : byte {
563 LocalBrightness = 0,
564 LocalContrast = 1
565}
566
567table NormalizationLayer {
568 base:LayerBase;
569 descriptor:NormalizationDescriptor;
570}
571
572table NormalizationDescriptor {
573 normChannelType:NormalizationAlgorithmChannel = Across;
574 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
575 normSize:uint;
576 alpha:float;
577 beta:float;
578 k:float;
579 dataLayout:DataLayout = NCHW;
580}
581
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000582table MeanLayer {
583 base:LayerBase;
584 descriptor:MeanDescriptor;
585}
586
587table MeanDescriptor {
588 axis:[uint];
589 keepDims:bool = false;
590}
591
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000592table PadLayer {
593 base:LayerBase;
594 descriptor:PadDescriptor;
595}
596
597table PadDescriptor {
598 padList:[uint];
David Monahan34757812019-06-19 11:47:21 +0100599 padValue:float = 0;
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000600}
601
josh minor4a3c6102020-01-06 16:40:46 -0600602/// @deprecated Use ElementwiseUnaryLayer instead
Sadik Armagan8b42a382019-03-01 14:24:49 +0000603table RsqrtLayer {
604 base:LayerBase;
605}
606
ruoyan018e7fa232019-02-28 15:09:07 +0000607table BatchNormalizationLayer {
608 base:LayerBase;
609 descriptor:BatchNormalizationDescriptor;
610 mean:ConstTensor;
611 variance:ConstTensor;
612 beta:ConstTensor;
613 gamma:ConstTensor;
614}
615
616table BatchNormalizationDescriptor {
617 eps:float;
618 dataLayout:DataLayout;
619}
620
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100621/// @deprecated Use ResizeLayer instead
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000622table ResizeBilinearLayer {
623 base:LayerBase;
624 descriptor:ResizeBilinearDescriptor;
625}
626
627table ResizeBilinearDescriptor {
628 targetWidth:uint;
629 targetHeight:uint;
630 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100631 alignCorners:bool;
632 halfPixelCenters:bool;
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000633}
634
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100635table SliceLayer {
636 base:LayerBase;
637 descriptor:SliceDescriptor;
638}
639
640table SliceDescriptor {
641 begin:[uint];
642 size:[uint];
643}
644
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000645table StridedSliceLayer {
646 base:LayerBase;
647 descriptor:StridedSliceDescriptor;
648}
649
650table StridedSliceDescriptor {
651 begin:[int];
652 end:[int];
653 stride:[int];
654 beginMask:int;
655 endMask:int;
656 shrinkAxisMask:int;
657 ellipsisMask:int;
658 newAxisMask:int;
659 dataLayout:DataLayout;
660}
661
Jim Flynne242f2d2019-05-22 14:24:13 +0100662table ConcatLayer {
663 base:LayerBase;
664 descriptor:OriginsDescriptor;
665}
666
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100667/// @deprecated Use ConcatLayer instead
Jim Flynnac25a1b2019-02-28 10:40:49 +0000668table MergerLayer {
669 base:LayerBase;
670 descriptor:OriginsDescriptor;
671}
672
673table UintVector {
674 data:[uint];
675}
676
677table OriginsDescriptor {
678 concatAxis:uint;
679 numViews:uint;
680 numDimensions:uint;
681 viewOrigins:[UintVector];
682}
683
Jim Flynn18ce3382019-03-08 11:08:30 +0000684table ViewsDescriptor {
685 origins:OriginsDescriptor;
686 viewSizes:[UintVector];
687}
688
689table SplitterLayer {
690 base:LayerBase;
691 descriptor:ViewsDescriptor;
692}
693
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000694table DetectionPostProcessLayer {
695 base:LayerBase;
696 descriptor:DetectionPostProcessDescriptor;
697 anchors:ConstTensor;
698}
699
700table DetectionPostProcessDescriptor {
701 maxDetections:uint;
702 maxClassesPerDetection:uint;
703 detectionsPerClass:uint;
704 nmsScoreThreshold:float;
705 nmsIouThreshold:float;
706 numClasses:uint;
707 useRegularNms:bool;
708 scaleX:float;
709 scaleY:float;
710 scaleW:float;
711 scaleH:float;
712}
713
Jim Flynn11af3752019-03-19 17:22:29 +0000714table LstmInputParams {
715 inputToForgetWeights:ConstTensor;
716 inputToCellWeights:ConstTensor;
717 inputToOutputWeights:ConstTensor;
718 recurrentToForgetWeights:ConstTensor;
719 recurrentToCellWeights:ConstTensor;
720 recurrentToOutputWeights:ConstTensor;
721 forgetGateBias:ConstTensor;
722 cellBias:ConstTensor;
723 outputGateBias:ConstTensor;
724
725 inputToInputWeights:ConstTensor;
726 recurrentToInputWeights:ConstTensor;
727 cellToInputWeights:ConstTensor;
728 inputGateBias:ConstTensor;
729
730 projectionWeights:ConstTensor;
731 projectionBias:ConstTensor;
732
733 cellToForgetWeights:ConstTensor;
734 cellToOutputWeights:ConstTensor;
Jan Eilersf8c62972019-07-17 11:07:49 +0100735
736 inputLayerNormWeights:ConstTensor;
737 forgetLayerNormWeights:ConstTensor;
738 cellLayerNormWeights:ConstTensor;
739 outputLayerNormWeights:ConstTensor;
Jim Flynn11af3752019-03-19 17:22:29 +0000740}
741
James Conroy8d333182020-05-13 10:27:58 +0100742table LstmDescriptor {
743 activationFunc:uint;
744 clippingThresCell:float;
745 clippingThresProj:float;
746 cifgEnabled:bool = true;
747 peepholeEnabled:bool = false;
748 projectionEnabled:bool = false;
749 layerNormEnabled:bool = false;
750}
751
752table LstmLayer {
753 base:LayerBase;
754 descriptor:LstmDescriptor;
755 inputParams:LstmInputParams;
756}
757
758table QLstmInputParams {
759 // Mandatory
760 inputToForgetWeights:ConstTensor;
761 inputToCellWeights:ConstTensor;
762 inputToOutputWeights:ConstTensor;
763
764 recurrentToForgetWeights:ConstTensor;
765 recurrentToCellWeights:ConstTensor;
766 recurrentToOutputWeights:ConstTensor;
767
768 forgetGateBias:ConstTensor;
769 cellBias:ConstTensor;
770 outputGateBias:ConstTensor;
771
772 // CIFG
773 inputToInputWeights:ConstTensor;
774 recurrentToInputWeights:ConstTensor;
775 inputGateBias:ConstTensor;
776
777 // Projection
778 projectionWeights:ConstTensor;
779 projectionBias:ConstTensor;
780
781 // Peephole
782 cellToInputWeights:ConstTensor;
783 cellToForgetWeights:ConstTensor;
784 cellToOutputWeights:ConstTensor;
785
786 // Layer norm
787 inputLayerNormWeights:ConstTensor;
788 forgetLayerNormWeights:ConstTensor;
789 cellLayerNormWeights:ConstTensor;
790 outputLayerNormWeights:ConstTensor;
791}
792
793table QLstmDescriptor {
794 cifgEnabled:bool = true;
795 peepholeEnabled:bool = false;
796 projectionEnabled:bool = false;
797 layerNormEnabled:bool = false;
798
799 cellClip:float;
800 projectionClip:float;
801
802 inputIntermediateScale:float;
803 forgetIntermediateScale:float;
804 cellIntermediateScale:float;
805 outputIntermediateScale:float;
806
807 hiddenStateZeroPoint:int;
808 hiddenStateScale:float;
809}
810
811table QLstmLayer {
812 base:LayerBase;
813 descriptor:QLstmDescriptor;
814 inputParams:QLstmInputParams;
815}
816
Jan Eilers5b01a892019-07-23 09:47:43 +0100817table QuantizedLstmInputParams {
818 inputToInputWeights:ConstTensor;
819 inputToForgetWeights:ConstTensor;
820 inputToCellWeights:ConstTensor;
821 inputToOutputWeights:ConstTensor;
822
823 recurrentToInputWeights:ConstTensor;
824 recurrentToForgetWeights:ConstTensor;
825 recurrentToCellWeights:ConstTensor;
826 recurrentToOutputWeights:ConstTensor;
827
828 inputGateBias:ConstTensor;
829 forgetGateBias:ConstTensor;
830 cellBias:ConstTensor;
831 outputGateBias:ConstTensor;
832}
833
Jan Eilers5b01a892019-07-23 09:47:43 +0100834table QuantizedLstmLayer {
835 base:LayerBase;
836 inputParams:QuantizedLstmInputParams;
837}
838
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000839table DequantizeLayer {
840 base:LayerBase;
841}
842
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100843table MergeLayer {
844 base:LayerBase;
845}
846
Sadik Armaganeff363d2019-04-05 15:25:46 +0100847table SwitchLayer {
848 base:LayerBase;
849}
850
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100851table PreluLayer {
852 base:LayerBase;
853}
854
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100855table TransposeConvolution2dLayer {
856 base:LayerBase;
857 descriptor:TransposeConvolution2dDescriptor;
858 weights:ConstTensor;
859 biases:ConstTensor;
860}
861
862table TransposeConvolution2dDescriptor {
863 padLeft:uint;
864 padRight:uint;
865 padTop:uint;
866 padBottom:uint;
867 strideX:uint;
868 strideY:uint;
869 biasEnabled:bool = false;
870 dataLayout:DataLayout = NCHW;
871}
872
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000873table TransposeLayer {
874 base:LayerBase;
875 descriptor:TransposeDescriptor;
876}
877
878table TransposeDescriptor {
879 dimMappings:[uint];
880}
881
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100882table ResizeLayer {
883 base:LayerBase;
884 descriptor:ResizeDescriptor;
885}
886
887table ResizeDescriptor {
888 targetHeight:uint;
889 targetWidth:uint;
890 method:ResizeMethod = NearestNeighbor;
891 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100892 alignCorners:bool;
893 halfPixelCenters:bool;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100894}
895
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100896table StackLayer {
897 base:LayerBase;
898 descriptor:StackDescriptor;
899}
900
901table StackDescriptor {
902 axis:uint;
903 numInputs:uint;
904 inputShape:[uint];
905}
906
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100907table StandInDescriptor {
908 numInputs:uint;
909 numOutputs:uint;
910}
911
912table StandInLayer {
913 base:LayerBase;
914 descriptor:StandInDescriptor;
915}
916
Finn Williams2605b232020-06-10 15:53:46 +0100917table RankLayer {
918 base:LayerBase;
919}
920
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000921table ReduceLayer {
922 base:LayerBase;
923 descriptor:ReduceDescriptor;
924}
925
926table ReduceDescriptor {
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000927 keepDims:bool = false;
928 axis:[uint];
929 reduceOperation:ReduceOperation = Sum;
930}
931
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100932table UnidirectionalSequenceLstmDescriptor {
933 activationFunc:uint;
934 clippingThresCell:float;
935 clippingThresProj:float;
936 cifgEnabled:bool = true;
937 peepholeEnabled:bool = false;
938 projectionEnabled:bool = false;
939 layerNormEnabled:bool = false;
940 timeMajor:bool = false;
941}
942
943table UnidirectionalSequenceLstmLayer {
944 base:LayerBase;
945 descriptor:UnidirectionalSequenceLstmDescriptor;
946 inputParams:LstmInputParams;
947}
948
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000949union Layer {
Mike Kellyaf484012019-02-20 16:53:11 +0000950 ActivationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000951 AdditionLayer,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000952 BatchToSpaceNdLayer,
ruoyan018e7fa232019-02-28 15:09:07 +0000953 BatchNormalizationLayer,
Conor Kennedy76277882019-02-26 08:29:54 +0000954 ConstantLayer,
Mike Kellya0766c32019-02-19 17:22:07 +0000955 Convolution2dLayer,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000956 DepthwiseConvolution2dLayer,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000957 FullyConnectedLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000958 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +0000959 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000960 OutputLayer,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000961 PermuteLayer,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000962 Pooling2dLayer,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000963 ReshapeLayer,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000964 SoftmaxLayer,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000965 SpaceToBatchNdLayer,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000966 DivisionLayer,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000967 MinimumLayer,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000968 EqualLayer,
Nina Drozd57728782019-02-27 10:53:27 +0000969 MaximumLayer,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000970 NormalizationLayer,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000971 PadLayer,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000972 RsqrtLayer,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000973 FloorLayer,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000974 GreaterLayer,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000975 ResizeBilinearLayer,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000976 SubtractionLayer,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000977 StridedSliceLayer,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000978 GatherLayer,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000979 MeanLayer,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000980 MergerLayer,
Jim Flynn18ce3382019-03-08 11:08:30 +0000981 L2NormalizationLayer,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000982 SplitterLayer,
Jim Flynn11af3752019-03-19 17:22:29 +0000983 DetectionPostProcessLayer,
Derek Lamberti87acb272019-03-27 16:51:31 +0000984 LstmLayer,
Jan Eilers5b01a892019-07-23 09:47:43 +0100985 QuantizedLstmLayer,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000986 QuantizeLayer,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100987 DequantizeLayer,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100988 MergeLayer,
Jim Flynne242f2d2019-05-22 14:24:13 +0100989 SwitchLayer,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100990 ConcatLayer,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100991 SpaceToDepthLayer,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100992 PreluLayer,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100993 TransposeConvolution2dLayer,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100994 ResizeLayer,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100995 StackLayer,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100996 AbsLayer,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100997 ArgMinMaxLayer,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100998 SliceLayer,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100999 DepthToSpaceLayer,
Sadik Armagan26257852019-10-14 13:00:47 +01001000 InstanceNormalizationLayer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001001 LogSoftmaxLayer,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +01001002 ComparisonLayer,
josh minor4a3c6102020-01-06 16:40:46 -06001003 StandInLayer,
Mike Kellyc9ea45a2020-02-28 18:11:58 +00001004 ElementwiseUnaryLayer,
James Conroy8d333182020-05-13 10:27:58 +01001005 TransposeLayer,
Keith Davis300ad562020-06-04 16:34:23 +01001006 QLstmLayer,
Finn Williams2605b232020-06-10 15:53:46 +01001007 FillLayer,
James Conroyaba90cd2020-11-06 16:28:18 +00001008 RankLayer,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +00001009 LogicalBinaryLayer,
mathad01b392e982021-04-07 12:07:30 +01001010 ReduceLayer,
Keith Davis3ae3f972021-05-21 16:33:48 +01001011 CastLayer,
Narumol Prangnawarata0162e12021-07-23 14:47:49 +01001012 ShapeLayer,
1013 UnidirectionalSequenceLstmLayer,
Simon Obute51f67772021-09-03 15:50:13 +01001014 ChannelShuffleLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001015}
1016
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001017table AnyLayer {
1018 layer:Layer;
1019}
1020
Tee Jungaa920c52019-11-05 10:48:25 +00001021table FeatureCompatibilityVersions {
1022 bindingIdsScheme:uint = 0;
Jan Eilers53ef7952021-06-02 12:01:25 +01001023 weightsLayoutScheme:uint = 0;
Matthew Sloyan81beae32021-07-13 19:46:11 +01001024 constantTensorsAsInputs:uint = 0;
Tee Jungaa920c52019-11-05 10:48:25 +00001025}
1026
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001027// Root type for serialized data is the graph of the network
1028table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001029 layers:[AnyLayer];
Tee Jungaa920c52019-11-05 10:48:25 +00001030 inputIds:[int];
1031 outputIds:[int];
1032 featureVersions:FeatureCompatibilityVersions;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001033}
1034
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +00001035root_type SerializedGraph;