blob: 85435a366ff77442399483ce5edb4e83be87fbae [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,
55 Min = 3
56}
57
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +010058enum ResizeMethod: byte {
59 NearestNeighbor = 0,
60 Bilinear = 1,
61}
62
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000063table TensorInfo {
64 dimensions:[uint];
65 dataType:DataType;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000066 quantizationScale:float = 1.0; // @deprecated Use quantizationScales instead
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000067 quantizationOffset:int = 0;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000068 quantizationScales:[float];
69 quantizationDim:uint;
Finn Williams2605b232020-06-10 15:53:46 +010070 dimensionality:uint = 1;
Colm Donelan800b2812021-02-12 12:43:35 +000071 dimensionSpecificity:[bool];
Matthew Sloyan81beae32021-07-13 19:46:11 +010072 isConstant:bool = false;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000073}
74
75struct Connection {
76 sourceLayerIndex:uint;
77 outputSlotIndex:uint;
78}
79
80table ByteData {
81 data:[byte];
82}
83
84table ShortData {
85 data:[short];
86}
87
88table IntData {
89 data:[int];
90}
91
92table LongData {
93 data:[long];
94}
95
96union ConstTensorData { ByteData, ShortData, IntData, LongData }
97
98table ConstTensor {
99 info:TensorInfo;
100 data:ConstTensorData;
101}
102
103table InputSlot {
104 index:uint;
105 connection:Connection;
106}
107
108table OutputSlot {
109 index:uint;
110 tensorInfo:TensorInfo;
111}
112
113enum LayerType : uint {
114 Addition = 0,
115 Input = 1,
Sadik Armagan5f450272019-02-12 14:31:45 +0000116 Multiplication = 2,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000117 Output = 3,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000118 Pooling2d = 4,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000119 Reshape = 5,
Mike Kellya0766c32019-02-19 17:22:07 +0000120 Softmax = 6,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000121 Convolution2d = 7,
Mike Kellyaf484012019-02-20 16:53:11 +0000122 DepthwiseConvolution2d = 8,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000123 Activation = 9,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000124 Permute = 10,
Conor Kennedy76277882019-02-26 08:29:54 +0000125 FullyConnected = 11,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000126 Constant = 12,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000127 SpaceToBatchNd = 13,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000128 BatchToSpaceNd = 14,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000129 Division = 15,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000130 Minimum = 16,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000131 Equal = 17,
Nina Drozd57728782019-02-27 10:53:27 +0000132 Maximum = 18,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000133 Normalization = 19,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000134 Pad = 20,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000135 Rsqrt = 21,
ruoyan018e7fa232019-02-28 15:09:07 +0000136 Floor = 22,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000137 BatchNormalization = 23,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000138 Greater = 24,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000139 ResizeBilinear = 25,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000140 Subtraction = 26,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000141 StridedSlice = 27,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000142 Gather = 28,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000143 Mean = 29,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000144 Merger = 30,
Jim Flynn18ce3382019-03-08 11:08:30 +0000145 L2Normalization = 31,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000146 Splitter = 32,
Jim Flynn11af3752019-03-19 17:22:29 +0000147 DetectionPostProcess = 33,
Derek Lamberti87acb272019-03-27 16:51:31 +0000148 Lstm = 34,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000149 Quantize = 35,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100150 Dequantize = 36,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100151 Merge = 37,
Jim Flynne242f2d2019-05-22 14:24:13 +0100152 Switch = 38,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100153 Concat = 39,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100154 SpaceToDepth = 40,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100155 Prelu = 41,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100156 TransposeConvolution2d = 42,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100157 Resize = 43,
Jan Eilers5b01a892019-07-23 09:47:43 +0100158 Stack = 44,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100159 QuantizedLstm = 45,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100160 Abs = 46,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100161 ArgMinMax = 47,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100162 Slice = 48,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100163 DepthToSpace = 49,
Sadik Armagan26257852019-10-14 13:00:47 +0100164 InstanceNormalization = 50,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100165 LogSoftmax = 51,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100166 Comparison = 52,
josh minor4a3c6102020-01-06 16:40:46 -0600167 StandIn = 53,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000168 ElementwiseUnary = 54,
James Conroy8d333182020-05-13 10:27:58 +0100169 Transpose = 55,
Keith Davis300ad562020-06-04 16:34:23 +0100170 QLstm = 56,
Finn Williams2605b232020-06-10 15:53:46 +0100171 Fill = 57,
James Conroyaba90cd2020-11-06 16:28:18 +0000172 Rank = 58,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000173 LogicalBinary = 59,
mathad01b392e982021-04-07 12:07:30 +0100174 Reduce = 60,
Keith Davis3ae3f972021-05-21 16:33:48 +0100175 Cast = 61,
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100176 Shape = 62,
177 UnidirectionalSequenceLstm = 63,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000178}
179
180// Base layer table to be used as part of other layers
181table LayerBase {
182 index:uint;
183 layerName:string;
184 layerType:LayerType;
185 inputSlots:[InputSlot];
186 outputSlots:[OutputSlot];
187}
188
189table BindableLayerBase {
190 base:LayerBase;
191 layerBindingId:int;
192}
193
194// Table for each layer defined below
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100195
josh minor4a3c6102020-01-06 16:40:46 -0600196/// @deprecated Use ElementwiseUnaryLayer instead
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100197table AbsLayer {
198 base:LayerBase;
199}
200
Mike Kellyaf484012019-02-20 16:53:11 +0000201table ActivationLayer {
202 base:LayerBase;
203 descriptor:ActivationDescriptor;
204}
205
206table ActivationDescriptor {
Tee Jung86bc3d82019-10-01 11:25:56 +0900207 activationFunction:ActivationFunction = Sigmoid;
Mike Kellyaf484012019-02-20 16:53:11 +0000208 a:float;
209 b:float;
210}
211
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000212table AdditionLayer {
213 base:LayerBase;
214}
215
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100216table ArgMinMaxLayer {
217 base:LayerBase;
218 descriptor:ArgMinMaxDescriptor;
219}
220
221table ArgMinMaxDescriptor{
Tee Jung86bc3d82019-10-01 11:25:56 +0900222 argMinMaxFunction:ArgMinMaxFunction;
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100223 axis:int;
224}
225
mathad01b392e982021-04-07 12:07:30 +0100226table CastLayer {
227 base:LayerBase;
228}
229
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100230enum ComparisonOperation : byte {
231 Equal = 0,
232 Greater = 1,
233 GreaterOrEqual = 2,
234 Less = 3,
235 LessOrEqual = 4,
236 NotEqual = 5
237}
238
239table ComparisonDescriptor {
240 operation:ComparisonOperation;
241}
242
243table ComparisonLayer {
244 base:LayerBase;
245 descriptor:ComparisonDescriptor;
246}
247
Conor Kennedy76277882019-02-26 08:29:54 +0000248table ConstantLayer {
249 base:LayerBase;
250 input:ConstTensor;
251}
252
Mike Kellya0766c32019-02-19 17:22:07 +0000253table Convolution2dLayer {
254 base:LayerBase;
255 descriptor:Convolution2dDescriptor;
256 weights:ConstTensor;
257 biases:ConstTensor;
258}
259
260table Convolution2dDescriptor {
261 padLeft:uint;
262 padRight:uint;
263 padTop:uint;
264 padBottom:uint;
265 strideX:uint;
266 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100267 dilationX:uint = 1;
268 dilationY:uint = 1;
Mike Kellya0766c32019-02-19 17:22:07 +0000269 biasEnabled:bool = false;
270 dataLayout:DataLayout = NCHW;
271}
272
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100273table DepthToSpaceLayer {
274 base:LayerBase;
275 descriptor:DepthToSpaceDescriptor;
276}
277
278table DepthToSpaceDescriptor {
279 blockSize:uint;
280 dataLayout:DataLayout;
281}
282
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000283table DivisionLayer {
284 base:LayerBase;
285}
286
josh minor4a3c6102020-01-06 16:40:46 -0600287enum UnaryOperation : byte {
288 Abs = 0,
289 Rsqrt = 1,
290 Sqrt = 2,
291 Exp = 3,
James Conroyaba90cd2020-11-06 16:28:18 +0000292 Neg = 4,
Teresa Charlin50de4fa2021-05-31 18:47:33 +0100293 LogicalNot = 5,
294 Log = 6,
295 Sin = 7
josh minor4a3c6102020-01-06 16:40:46 -0600296}
297
298table ElementwiseUnaryDescriptor {
299 operation:UnaryOperation;
300}
301
302table ElementwiseUnaryLayer {
303 base:LayerBase;
304 descriptor:ElementwiseUnaryDescriptor;
305}
306
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100307/// @deprecated Use ComparisonLayer instead
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000308table EqualLayer {
309 base:LayerBase;
310}
311
Keith Davis300ad562020-06-04 16:34:23 +0100312table FillLayer {
313 base:LayerBase;
314 descriptor:FillDescriptor;
315}
316
317table FillDescriptor {
318 value:float;
319}
320
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000321table FloorLayer{
322 base:LayerBase;
323}
324
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000325table FullyConnectedLayer {
326 base:LayerBase;
327 descriptor:FullyConnectedDescriptor;
Matthew Sloyan81beae32021-07-13 19:46:11 +0100328 weights:ConstTensor; // ConstTensors are now passed as inputs.
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000329 biases:ConstTensor;
330}
331
332table FullyConnectedDescriptor {
333 biasEnabled:bool = false;
334 transposeWeightsMatrix:bool = false;
Sadik Armaganf0a6dec2021-03-25 07:46:55 +0000335 constantWeights:bool = true;
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000336}
337
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000338table GatherLayer {
339 base:LayerBase;
Teresa Charlin52664732020-06-29 16:27:03 +0100340 descriptor:GatherDescriptor;
341}
342
343table GatherDescriptor {
344 axis:int = 0;
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000345}
346
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100347/// @deprecated Use ComparisonLayer instead
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000348table GreaterLayer {
349 base:LayerBase;
350}
351
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000352table InputLayer {
353 base:BindableLayerBase;
354}
355
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100356table InstanceNormalizationLayer {
357 base:LayerBase;
358 descriptor:InstanceNormalizationDescriptor;
359}
360
361table InstanceNormalizationDescriptor {
362 gamma:float;
363 beta:float;
364 eps:float;
365 dataLayout:DataLayout;
366}
367
Sadik Armagan26257852019-10-14 13:00:47 +0100368table LogSoftmaxLayer {
369 base:LayerBase;
370 descriptor:LogSoftmaxDescriptor;
371}
372
373table LogSoftmaxDescriptor {
374 beta:float = 1;
375 axis:int = -1;
376}
377
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000378table L2NormalizationLayer {
379 base:LayerBase;
380 descriptor:L2NormalizationDescriptor;
381}
382
383table L2NormalizationDescriptor {
384 dataLayout:DataLayout = NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100385 eps:float = 1e-12;
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000386}
387
James Conroyaba90cd2020-11-06 16:28:18 +0000388enum LogicalBinaryOperation : byte {
389 LogicalAnd = 0,
390 LogicalOr = 1
391}
392
393table LogicalBinaryDescriptor {
394 operation:LogicalBinaryOperation;
395}
396
397table LogicalBinaryLayer {
398 base:LayerBase;
399 descriptor:LogicalBinaryDescriptor;
400}
401
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000402table MinimumLayer {
403 base:LayerBase;
404}
405
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000406table MaximumLayer {
407 base:LayerBase;
408}
409
Sadik Armagan5f450272019-02-12 14:31:45 +0000410table MultiplicationLayer {
411 base:LayerBase;
412}
413
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000414table Pooling2dLayer {
415 base:LayerBase;
416 descriptor:Pooling2dDescriptor;
417}
418
419enum PoolingAlgorithm : byte {
420 Max = 0,
421 Average = 1,
422 L2 = 2
423}
424
425enum OutputShapeRounding : byte {
426 Floor = 0,
427 Ceiling = 1
428}
429
430enum PaddingMethod : byte {
431 IgnoreValue = 0,
432 Exclude = 1
433}
434
435table Pooling2dDescriptor {
436 poolType:PoolingAlgorithm;
437 padLeft:uint;
438 padRight:uint;
439 padTop:uint;
440 padBottom:uint;
441 poolWidth:uint;
442 poolHeight:uint;
443 strideX:uint;
444 strideY:uint;
445 outputShapeRounding:OutputShapeRounding;
446 paddingMethod:PaddingMethod;
447 dataLayout:DataLayout;
448}
449
Derek Lamberti87acb272019-03-27 16:51:31 +0000450table QuantizeLayer {
451 base:LayerBase;
452}
453
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000454table SoftmaxLayer {
455 base:LayerBase;
456 descriptor:SoftmaxDescriptor;
457}
458
459table SoftmaxDescriptor {
460 beta:float;
461}
462
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000463table DepthwiseConvolution2dLayer {
464 base:LayerBase;
465 descriptor:DepthwiseConvolution2dDescriptor;
466 weights:ConstTensor;
467 biases:ConstTensor;
468}
469
470table DepthwiseConvolution2dDescriptor {
471 padLeft:uint;
472 padRight:uint;
473 padTop:uint;
474 padBottom:uint;
475 strideX:uint;
476 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100477 dilationX:uint = 1;
478 dilationY:uint = 1;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000479 biasEnabled:bool = false;
480 dataLayout:DataLayout = NCHW;
481}
482
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000483table OutputLayer {
484 base:BindableLayerBase;
485}
486
Saoirse Stewart263829c2019-02-19 15:54:14 +0000487table ReshapeLayer {
488 base:LayerBase;
489 descriptor:ReshapeDescriptor;
490}
491
492table ReshapeDescriptor {
Keith Davis3ae3f972021-05-21 16:33:48 +0100493 targetShape:[uint];
Saoirse Stewart263829c2019-02-19 15:54:14 +0000494}
495
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000496table PermuteLayer {
497 base:LayerBase;
498 descriptor:PermuteDescriptor;
499}
500
501table PermuteDescriptor {
502 dimMappings:[uint];
503}
504
Keith Davis3ae3f972021-05-21 16:33:48 +0100505table ShapeLayer {
506 base:LayerBase;
507}
508
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000509table SpaceToBatchNdLayer {
510 base:LayerBase;
511 descriptor:SpaceToBatchNdDescriptor;
512}
513
514table SpaceToBatchNdDescriptor {
515 blockShape:[uint];
516 padList:[uint];
517 dataLayout:DataLayout;
518}
519
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100520table SpaceToDepthLayer {
521 base:LayerBase;
522 descriptor:SpaceToDepthDescriptor;
523}
524
525table SpaceToDepthDescriptor {
526 blockSize:uint;
527 dataLayout:DataLayout;
528}
529
Conor Kennedyda1f9752019-03-01 14:37:12 +0000530table SubtractionLayer {
531 base:LayerBase;
532}
533
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000534table BatchToSpaceNdLayer {
535 base:LayerBase;
536 descriptor:BatchToSpaceNdDescriptor;
537}
538
539table BatchToSpaceNdDescriptor {
540 blockShape:[uint];
541 crops:[uint];
542 dataLayout:DataLayout;
543}
544
Nina Drozd57728782019-02-27 10:53:27 +0000545enum NormalizationAlgorithmChannel : byte {
546 Across = 0,
547 Within = 1
548}
549
550enum NormalizationAlgorithmMethod : byte {
551 LocalBrightness = 0,
552 LocalContrast = 1
553}
554
555table NormalizationLayer {
556 base:LayerBase;
557 descriptor:NormalizationDescriptor;
558}
559
560table NormalizationDescriptor {
561 normChannelType:NormalizationAlgorithmChannel = Across;
562 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
563 normSize:uint;
564 alpha:float;
565 beta:float;
566 k:float;
567 dataLayout:DataLayout = NCHW;
568}
569
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000570table MeanLayer {
571 base:LayerBase;
572 descriptor:MeanDescriptor;
573}
574
575table MeanDescriptor {
576 axis:[uint];
577 keepDims:bool = false;
578}
579
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000580table PadLayer {
581 base:LayerBase;
582 descriptor:PadDescriptor;
583}
584
585table PadDescriptor {
586 padList:[uint];
David Monahan34757812019-06-19 11:47:21 +0100587 padValue:float = 0;
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000588}
589
josh minor4a3c6102020-01-06 16:40:46 -0600590/// @deprecated Use ElementwiseUnaryLayer instead
Sadik Armagan8b42a382019-03-01 14:24:49 +0000591table RsqrtLayer {
592 base:LayerBase;
593}
594
ruoyan018e7fa232019-02-28 15:09:07 +0000595table BatchNormalizationLayer {
596 base:LayerBase;
597 descriptor:BatchNormalizationDescriptor;
598 mean:ConstTensor;
599 variance:ConstTensor;
600 beta:ConstTensor;
601 gamma:ConstTensor;
602}
603
604table BatchNormalizationDescriptor {
605 eps:float;
606 dataLayout:DataLayout;
607}
608
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100609/// @deprecated Use ResizeLayer instead
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000610table ResizeBilinearLayer {
611 base:LayerBase;
612 descriptor:ResizeBilinearDescriptor;
613}
614
615table ResizeBilinearDescriptor {
616 targetWidth:uint;
617 targetHeight:uint;
618 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100619 alignCorners:bool;
620 halfPixelCenters:bool;
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000621}
622
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100623table SliceLayer {
624 base:LayerBase;
625 descriptor:SliceDescriptor;
626}
627
628table SliceDescriptor {
629 begin:[uint];
630 size:[uint];
631}
632
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000633table StridedSliceLayer {
634 base:LayerBase;
635 descriptor:StridedSliceDescriptor;
636}
637
638table StridedSliceDescriptor {
639 begin:[int];
640 end:[int];
641 stride:[int];
642 beginMask:int;
643 endMask:int;
644 shrinkAxisMask:int;
645 ellipsisMask:int;
646 newAxisMask:int;
647 dataLayout:DataLayout;
648}
649
Jim Flynne242f2d2019-05-22 14:24:13 +0100650table ConcatLayer {
651 base:LayerBase;
652 descriptor:OriginsDescriptor;
653}
654
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100655/// @deprecated Use ConcatLayer instead
Jim Flynnac25a1b2019-02-28 10:40:49 +0000656table MergerLayer {
657 base:LayerBase;
658 descriptor:OriginsDescriptor;
659}
660
661table UintVector {
662 data:[uint];
663}
664
665table OriginsDescriptor {
666 concatAxis:uint;
667 numViews:uint;
668 numDimensions:uint;
669 viewOrigins:[UintVector];
670}
671
Jim Flynn18ce3382019-03-08 11:08:30 +0000672table ViewsDescriptor {
673 origins:OriginsDescriptor;
674 viewSizes:[UintVector];
675}
676
677table SplitterLayer {
678 base:LayerBase;
679 descriptor:ViewsDescriptor;
680}
681
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000682table DetectionPostProcessLayer {
683 base:LayerBase;
684 descriptor:DetectionPostProcessDescriptor;
685 anchors:ConstTensor;
686}
687
688table DetectionPostProcessDescriptor {
689 maxDetections:uint;
690 maxClassesPerDetection:uint;
691 detectionsPerClass:uint;
692 nmsScoreThreshold:float;
693 nmsIouThreshold:float;
694 numClasses:uint;
695 useRegularNms:bool;
696 scaleX:float;
697 scaleY:float;
698 scaleW:float;
699 scaleH:float;
700}
701
Jim Flynn11af3752019-03-19 17:22:29 +0000702table LstmInputParams {
703 inputToForgetWeights:ConstTensor;
704 inputToCellWeights:ConstTensor;
705 inputToOutputWeights:ConstTensor;
706 recurrentToForgetWeights:ConstTensor;
707 recurrentToCellWeights:ConstTensor;
708 recurrentToOutputWeights:ConstTensor;
709 forgetGateBias:ConstTensor;
710 cellBias:ConstTensor;
711 outputGateBias:ConstTensor;
712
713 inputToInputWeights:ConstTensor;
714 recurrentToInputWeights:ConstTensor;
715 cellToInputWeights:ConstTensor;
716 inputGateBias:ConstTensor;
717
718 projectionWeights:ConstTensor;
719 projectionBias:ConstTensor;
720
721 cellToForgetWeights:ConstTensor;
722 cellToOutputWeights:ConstTensor;
Jan Eilersf8c62972019-07-17 11:07:49 +0100723
724 inputLayerNormWeights:ConstTensor;
725 forgetLayerNormWeights:ConstTensor;
726 cellLayerNormWeights:ConstTensor;
727 outputLayerNormWeights:ConstTensor;
Jim Flynn11af3752019-03-19 17:22:29 +0000728}
729
James Conroy8d333182020-05-13 10:27:58 +0100730table LstmDescriptor {
731 activationFunc:uint;
732 clippingThresCell:float;
733 clippingThresProj:float;
734 cifgEnabled:bool = true;
735 peepholeEnabled:bool = false;
736 projectionEnabled:bool = false;
737 layerNormEnabled:bool = false;
738}
739
740table LstmLayer {
741 base:LayerBase;
742 descriptor:LstmDescriptor;
743 inputParams:LstmInputParams;
744}
745
746table QLstmInputParams {
747 // Mandatory
748 inputToForgetWeights:ConstTensor;
749 inputToCellWeights:ConstTensor;
750 inputToOutputWeights:ConstTensor;
751
752 recurrentToForgetWeights:ConstTensor;
753 recurrentToCellWeights:ConstTensor;
754 recurrentToOutputWeights:ConstTensor;
755
756 forgetGateBias:ConstTensor;
757 cellBias:ConstTensor;
758 outputGateBias:ConstTensor;
759
760 // CIFG
761 inputToInputWeights:ConstTensor;
762 recurrentToInputWeights:ConstTensor;
763 inputGateBias:ConstTensor;
764
765 // Projection
766 projectionWeights:ConstTensor;
767 projectionBias:ConstTensor;
768
769 // Peephole
770 cellToInputWeights:ConstTensor;
771 cellToForgetWeights:ConstTensor;
772 cellToOutputWeights:ConstTensor;
773
774 // Layer norm
775 inputLayerNormWeights:ConstTensor;
776 forgetLayerNormWeights:ConstTensor;
777 cellLayerNormWeights:ConstTensor;
778 outputLayerNormWeights:ConstTensor;
779}
780
781table QLstmDescriptor {
782 cifgEnabled:bool = true;
783 peepholeEnabled:bool = false;
784 projectionEnabled:bool = false;
785 layerNormEnabled:bool = false;
786
787 cellClip:float;
788 projectionClip:float;
789
790 inputIntermediateScale:float;
791 forgetIntermediateScale:float;
792 cellIntermediateScale:float;
793 outputIntermediateScale:float;
794
795 hiddenStateZeroPoint:int;
796 hiddenStateScale:float;
797}
798
799table QLstmLayer {
800 base:LayerBase;
801 descriptor:QLstmDescriptor;
802 inputParams:QLstmInputParams;
803}
804
Jan Eilers5b01a892019-07-23 09:47:43 +0100805table QuantizedLstmInputParams {
806 inputToInputWeights:ConstTensor;
807 inputToForgetWeights:ConstTensor;
808 inputToCellWeights:ConstTensor;
809 inputToOutputWeights:ConstTensor;
810
811 recurrentToInputWeights:ConstTensor;
812 recurrentToForgetWeights:ConstTensor;
813 recurrentToCellWeights:ConstTensor;
814 recurrentToOutputWeights:ConstTensor;
815
816 inputGateBias:ConstTensor;
817 forgetGateBias:ConstTensor;
818 cellBias:ConstTensor;
819 outputGateBias:ConstTensor;
820}
821
Jan Eilers5b01a892019-07-23 09:47:43 +0100822table QuantizedLstmLayer {
823 base:LayerBase;
824 inputParams:QuantizedLstmInputParams;
825}
826
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000827table DequantizeLayer {
828 base:LayerBase;
829}
830
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100831table MergeLayer {
832 base:LayerBase;
833}
834
Sadik Armaganeff363d2019-04-05 15:25:46 +0100835table SwitchLayer {
836 base:LayerBase;
837}
838
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100839table PreluLayer {
840 base:LayerBase;
841}
842
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100843table TransposeConvolution2dLayer {
844 base:LayerBase;
845 descriptor:TransposeConvolution2dDescriptor;
846 weights:ConstTensor;
847 biases:ConstTensor;
848}
849
850table TransposeConvolution2dDescriptor {
851 padLeft:uint;
852 padRight:uint;
853 padTop:uint;
854 padBottom:uint;
855 strideX:uint;
856 strideY:uint;
857 biasEnabled:bool = false;
858 dataLayout:DataLayout = NCHW;
859}
860
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000861table TransposeLayer {
862 base:LayerBase;
863 descriptor:TransposeDescriptor;
864}
865
866table TransposeDescriptor {
867 dimMappings:[uint];
868}
869
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100870table ResizeLayer {
871 base:LayerBase;
872 descriptor:ResizeDescriptor;
873}
874
875table ResizeDescriptor {
876 targetHeight:uint;
877 targetWidth:uint;
878 method:ResizeMethod = NearestNeighbor;
879 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100880 alignCorners:bool;
881 halfPixelCenters:bool;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100882}
883
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100884table StackLayer {
885 base:LayerBase;
886 descriptor:StackDescriptor;
887}
888
889table StackDescriptor {
890 axis:uint;
891 numInputs:uint;
892 inputShape:[uint];
893}
894
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100895table StandInDescriptor {
896 numInputs:uint;
897 numOutputs:uint;
898}
899
900table StandInLayer {
901 base:LayerBase;
902 descriptor:StandInDescriptor;
903}
904
Finn Williams2605b232020-06-10 15:53:46 +0100905table RankLayer {
906 base:LayerBase;
907}
908
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000909table ReduceLayer {
910 base:LayerBase;
911 descriptor:ReduceDescriptor;
912}
913
914table ReduceDescriptor {
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000915 keepDims:bool = false;
916 axis:[uint];
917 reduceOperation:ReduceOperation = Sum;
918}
919
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100920table UnidirectionalSequenceLstmDescriptor {
921 activationFunc:uint;
922 clippingThresCell:float;
923 clippingThresProj:float;
924 cifgEnabled:bool = true;
925 peepholeEnabled:bool = false;
926 projectionEnabled:bool = false;
927 layerNormEnabled:bool = false;
928 timeMajor:bool = false;
929}
930
931table UnidirectionalSequenceLstmLayer {
932 base:LayerBase;
933 descriptor:UnidirectionalSequenceLstmDescriptor;
934 inputParams:LstmInputParams;
935}
936
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000937union Layer {
Mike Kellyaf484012019-02-20 16:53:11 +0000938 ActivationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000939 AdditionLayer,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000940 BatchToSpaceNdLayer,
ruoyan018e7fa232019-02-28 15:09:07 +0000941 BatchNormalizationLayer,
Conor Kennedy76277882019-02-26 08:29:54 +0000942 ConstantLayer,
Mike Kellya0766c32019-02-19 17:22:07 +0000943 Convolution2dLayer,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000944 DepthwiseConvolution2dLayer,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000945 FullyConnectedLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000946 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +0000947 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000948 OutputLayer,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000949 PermuteLayer,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000950 Pooling2dLayer,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000951 ReshapeLayer,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000952 SoftmaxLayer,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000953 SpaceToBatchNdLayer,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000954 DivisionLayer,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000955 MinimumLayer,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000956 EqualLayer,
Nina Drozd57728782019-02-27 10:53:27 +0000957 MaximumLayer,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000958 NormalizationLayer,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000959 PadLayer,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000960 RsqrtLayer,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000961 FloorLayer,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000962 GreaterLayer,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000963 ResizeBilinearLayer,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000964 SubtractionLayer,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000965 StridedSliceLayer,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000966 GatherLayer,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000967 MeanLayer,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000968 MergerLayer,
Jim Flynn18ce3382019-03-08 11:08:30 +0000969 L2NormalizationLayer,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000970 SplitterLayer,
Jim Flynn11af3752019-03-19 17:22:29 +0000971 DetectionPostProcessLayer,
Derek Lamberti87acb272019-03-27 16:51:31 +0000972 LstmLayer,
Jan Eilers5b01a892019-07-23 09:47:43 +0100973 QuantizedLstmLayer,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000974 QuantizeLayer,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100975 DequantizeLayer,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100976 MergeLayer,
Jim Flynne242f2d2019-05-22 14:24:13 +0100977 SwitchLayer,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100978 ConcatLayer,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100979 SpaceToDepthLayer,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100980 PreluLayer,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100981 TransposeConvolution2dLayer,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100982 ResizeLayer,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100983 StackLayer,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100984 AbsLayer,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100985 ArgMinMaxLayer,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100986 SliceLayer,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100987 DepthToSpaceLayer,
Sadik Armagan26257852019-10-14 13:00:47 +0100988 InstanceNormalizationLayer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100989 LogSoftmaxLayer,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100990 ComparisonLayer,
josh minor4a3c6102020-01-06 16:40:46 -0600991 StandInLayer,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000992 ElementwiseUnaryLayer,
James Conroy8d333182020-05-13 10:27:58 +0100993 TransposeLayer,
Keith Davis300ad562020-06-04 16:34:23 +0100994 QLstmLayer,
Finn Williams2605b232020-06-10 15:53:46 +0100995 FillLayer,
James Conroyaba90cd2020-11-06 16:28:18 +0000996 RankLayer,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000997 LogicalBinaryLayer,
mathad01b392e982021-04-07 12:07:30 +0100998 ReduceLayer,
Keith Davis3ae3f972021-05-21 16:33:48 +0100999 CastLayer,
Narumol Prangnawarata0162e12021-07-23 14:47:49 +01001000 ShapeLayer,
1001 UnidirectionalSequenceLstmLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001002}
1003
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001004table AnyLayer {
1005 layer:Layer;
1006}
1007
Tee Jungaa920c52019-11-05 10:48:25 +00001008table FeatureCompatibilityVersions {
1009 bindingIdsScheme:uint = 0;
Jan Eilers53ef7952021-06-02 12:01:25 +01001010 weightsLayoutScheme:uint = 0;
Matthew Sloyan81beae32021-07-13 19:46:11 +01001011 constantTensorsAsInputs:uint = 0;
Tee Jungaa920c52019-11-05 10:48:25 +00001012}
1013
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001014// Root type for serialized data is the graph of the network
1015table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001016 layers:[AnyLayer];
Tee Jungaa920c52019-11-05 10:48:25 +00001017 inputIds:[int];
1018 outputIds:[int];
1019 featureVersions:FeatureCompatibilityVersions;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001020}
1021
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +00001022root_type SerializedGraph;