blob: c8ffce48bc1a9e6917fe97119ba2c1dbf033834a [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,
Matthew Sloyanb63a3112021-09-08 13:05:51 +010048 NCHW = 1,
Matthew Sloyan5d7b0a32021-10-18 13:07:49 +010049 NDHWC = 2,
50 NCDHW = 3
Saoirse Stewart3166c3e2019-02-18 15:24:53 +000051}
52
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +000053enum ReduceOperation: byte {
54 Sum = 0,
55 Max = 1,
56 Mean = 2,
Teresa Charlin4e3e8312021-08-05 12:34:37 +010057 Min = 3,
58 Prod = 4
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +000059}
60
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +010061enum ResizeMethod: byte {
62 NearestNeighbor = 0,
63 Bilinear = 1,
64}
65
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000066table TensorInfo {
67 dimensions:[uint];
68 dataType:DataType;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000069 quantizationScale:float = 1.0; // @deprecated Use quantizationScales instead
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000070 quantizationOffset:int = 0;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000071 quantizationScales:[float];
72 quantizationDim:uint;
Finn Williams2605b232020-06-10 15:53:46 +010073 dimensionality:uint = 1;
Colm Donelan800b2812021-02-12 12:43:35 +000074 dimensionSpecificity:[bool];
Matthew Sloyan81beae32021-07-13 19:46:11 +010075 isConstant:bool = false;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000076}
77
78struct Connection {
79 sourceLayerIndex:uint;
80 outputSlotIndex:uint;
81}
82
83table ByteData {
84 data:[byte];
85}
86
87table ShortData {
88 data:[short];
89}
90
91table IntData {
92 data:[int];
93}
94
95table LongData {
96 data:[long];
97}
98
99union ConstTensorData { ByteData, ShortData, IntData, LongData }
100
101table ConstTensor {
102 info:TensorInfo;
103 data:ConstTensorData;
104}
105
106table InputSlot {
107 index:uint;
108 connection:Connection;
109}
110
111table OutputSlot {
112 index:uint;
113 tensorInfo:TensorInfo;
114}
115
116enum LayerType : uint {
117 Addition = 0,
118 Input = 1,
Sadik Armagan5f450272019-02-12 14:31:45 +0000119 Multiplication = 2,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000120 Output = 3,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000121 Pooling2d = 4,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000122 Reshape = 5,
Mike Kellya0766c32019-02-19 17:22:07 +0000123 Softmax = 6,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000124 Convolution2d = 7,
Mike Kellyaf484012019-02-20 16:53:11 +0000125 DepthwiseConvolution2d = 8,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000126 Activation = 9,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000127 Permute = 10,
Conor Kennedy76277882019-02-26 08:29:54 +0000128 FullyConnected = 11,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000129 Constant = 12,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000130 SpaceToBatchNd = 13,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000131 BatchToSpaceNd = 14,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000132 Division = 15,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000133 Minimum = 16,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000134 Equal = 17,
Nina Drozd57728782019-02-27 10:53:27 +0000135 Maximum = 18,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000136 Normalization = 19,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000137 Pad = 20,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000138 Rsqrt = 21,
ruoyan018e7fa232019-02-28 15:09:07 +0000139 Floor = 22,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000140 BatchNormalization = 23,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000141 Greater = 24,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000142 ResizeBilinear = 25,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000143 Subtraction = 26,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000144 StridedSlice = 27,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000145 Gather = 28,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000146 Mean = 29,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000147 Merger = 30,
Jim Flynn18ce3382019-03-08 11:08:30 +0000148 L2Normalization = 31,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000149 Splitter = 32,
Jim Flynn11af3752019-03-19 17:22:29 +0000150 DetectionPostProcess = 33,
Derek Lamberti87acb272019-03-27 16:51:31 +0000151 Lstm = 34,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000152 Quantize = 35,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100153 Dequantize = 36,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100154 Merge = 37,
Jim Flynne242f2d2019-05-22 14:24:13 +0100155 Switch = 38,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100156 Concat = 39,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100157 SpaceToDepth = 40,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100158 Prelu = 41,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100159 TransposeConvolution2d = 42,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100160 Resize = 43,
Jan Eilers5b01a892019-07-23 09:47:43 +0100161 Stack = 44,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100162 QuantizedLstm = 45,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100163 Abs = 46,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100164 ArgMinMax = 47,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100165 Slice = 48,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100166 DepthToSpace = 49,
Sadik Armagan26257852019-10-14 13:00:47 +0100167 InstanceNormalization = 50,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100168 LogSoftmax = 51,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100169 Comparison = 52,
josh minor4a3c6102020-01-06 16:40:46 -0600170 StandIn = 53,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000171 ElementwiseUnary = 54,
James Conroy8d333182020-05-13 10:27:58 +0100172 Transpose = 55,
Keith Davis300ad562020-06-04 16:34:23 +0100173 QLstm = 56,
Finn Williams2605b232020-06-10 15:53:46 +0100174 Fill = 57,
James Conroyaba90cd2020-11-06 16:28:18 +0000175 Rank = 58,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000176 LogicalBinary = 59,
mathad01b392e982021-04-07 12:07:30 +0100177 Reduce = 60,
Keith Davis3ae3f972021-05-21 16:33:48 +0100178 Cast = 61,
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100179 Shape = 62,
180 UnidirectionalSequenceLstm = 63,
Simon Obute51f67772021-09-03 15:50:13 +0100181 ChannelShuffle = 64,
Matthew Sloyanb63a3112021-09-08 13:05:51 +0100182 Convolution3d = 65,
Tamas Nyirid998a1c2021-11-05 14:55:33 +0000183 Pooling3d = 66,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000184}
185
186// Base layer table to be used as part of other layers
187table LayerBase {
188 index:uint;
189 layerName:string;
190 layerType:LayerType;
191 inputSlots:[InputSlot];
192 outputSlots:[OutputSlot];
193}
194
195table BindableLayerBase {
196 base:LayerBase;
197 layerBindingId:int;
198}
199
200// Table for each layer defined below
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100201
josh minor4a3c6102020-01-06 16:40:46 -0600202/// @deprecated Use ElementwiseUnaryLayer instead
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100203table AbsLayer {
204 base:LayerBase;
205}
206
Mike Kellyaf484012019-02-20 16:53:11 +0000207table ActivationLayer {
208 base:LayerBase;
209 descriptor:ActivationDescriptor;
210}
211
212table ActivationDescriptor {
Tee Jung86bc3d82019-10-01 11:25:56 +0900213 activationFunction:ActivationFunction = Sigmoid;
Mike Kellyaf484012019-02-20 16:53:11 +0000214 a:float;
215 b:float;
216}
217
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000218table AdditionLayer {
219 base:LayerBase;
220}
221
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100222table ArgMinMaxLayer {
223 base:LayerBase;
224 descriptor:ArgMinMaxDescriptor;
225}
226
227table ArgMinMaxDescriptor{
Tee Jung86bc3d82019-10-01 11:25:56 +0900228 argMinMaxFunction:ArgMinMaxFunction;
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100229 axis:int;
230}
231
mathad01b392e982021-04-07 12:07:30 +0100232table CastLayer {
233 base:LayerBase;
234}
235
Simon Obute51f67772021-09-03 15:50:13 +0100236table ChannelShuffleLayer {
237 base:LayerBase;
238 descriptor:ChannelShuffleDescriptor;
239}
240
241table ChannelShuffleDescriptor {
242 axis:uint = 0;
243 numGroups:uint = 0;
244}
245
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100246enum ComparisonOperation : byte {
247 Equal = 0,
248 Greater = 1,
249 GreaterOrEqual = 2,
250 Less = 3,
251 LessOrEqual = 4,
252 NotEqual = 5
253}
254
255table ComparisonDescriptor {
256 operation:ComparisonOperation;
257}
258
259table ComparisonLayer {
260 base:LayerBase;
261 descriptor:ComparisonDescriptor;
262}
263
Conor Kennedy76277882019-02-26 08:29:54 +0000264table ConstantLayer {
265 base:LayerBase;
266 input:ConstTensor;
267}
268
Mike Kellya0766c32019-02-19 17:22:07 +0000269table Convolution2dLayer {
270 base:LayerBase;
271 descriptor:Convolution2dDescriptor;
272 weights:ConstTensor;
273 biases:ConstTensor;
274}
275
276table Convolution2dDescriptor {
277 padLeft:uint;
278 padRight:uint;
279 padTop:uint;
280 padBottom:uint;
281 strideX:uint;
282 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100283 dilationX:uint = 1;
284 dilationY:uint = 1;
Mike Kellya0766c32019-02-19 17:22:07 +0000285 biasEnabled:bool = false;
286 dataLayout:DataLayout = NCHW;
287}
288
Matthew Sloyanb63a3112021-09-08 13:05:51 +0100289table Convolution3dLayer {
290 base:LayerBase;
291 descriptor:Convolution3dDescriptor;
Matthew Sloyanb63a3112021-09-08 13:05:51 +0100292}
293
294table Convolution3dDescriptor {
295 padLeft:uint;
296 padRight:uint;
297 padTop:uint;
298 padBottom:uint;
299 padFront:uint;
300 padBack:uint;
301 strideX:uint;
302 strideY:uint;
303 strideZ:uint;
304 dilationX:uint = 1;
305 dilationY:uint = 1;
306 dilationZ:uint = 1;
307 biasEnabled:bool = false;
308 dataLayout:DataLayout = NDHWC;
309}
310
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100311table DepthToSpaceLayer {
312 base:LayerBase;
313 descriptor:DepthToSpaceDescriptor;
314}
315
316table DepthToSpaceDescriptor {
317 blockSize:uint;
318 dataLayout:DataLayout;
319}
320
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000321table DivisionLayer {
322 base:LayerBase;
323}
324
josh minor4a3c6102020-01-06 16:40:46 -0600325enum UnaryOperation : byte {
326 Abs = 0,
327 Rsqrt = 1,
328 Sqrt = 2,
329 Exp = 3,
James Conroyaba90cd2020-11-06 16:28:18 +0000330 Neg = 4,
Teresa Charlin50de4fa2021-05-31 18:47:33 +0100331 LogicalNot = 5,
332 Log = 6,
333 Sin = 7
josh minor4a3c6102020-01-06 16:40:46 -0600334}
335
336table ElementwiseUnaryDescriptor {
337 operation:UnaryOperation;
338}
339
340table ElementwiseUnaryLayer {
341 base:LayerBase;
342 descriptor:ElementwiseUnaryDescriptor;
343}
344
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100345/// @deprecated Use ComparisonLayer instead
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000346table EqualLayer {
347 base:LayerBase;
348}
349
Keith Davis300ad562020-06-04 16:34:23 +0100350table FillLayer {
351 base:LayerBase;
352 descriptor:FillDescriptor;
353}
354
355table FillDescriptor {
356 value:float;
357}
358
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000359table FloorLayer{
360 base:LayerBase;
361}
362
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000363table FullyConnectedLayer {
364 base:LayerBase;
365 descriptor:FullyConnectedDescriptor;
Matthew Sloyan81beae32021-07-13 19:46:11 +0100366 weights:ConstTensor; // ConstTensors are now passed as inputs.
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000367 biases:ConstTensor;
368}
369
370table FullyConnectedDescriptor {
371 biasEnabled:bool = false;
372 transposeWeightsMatrix:bool = false;
Sadik Armaganf0a6dec2021-03-25 07:46:55 +0000373 constantWeights:bool = true;
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000374}
375
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000376table GatherLayer {
377 base:LayerBase;
Teresa Charlin52664732020-06-29 16:27:03 +0100378 descriptor:GatherDescriptor;
379}
380
381table GatherDescriptor {
382 axis:int = 0;
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000383}
384
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100385/// @deprecated Use ComparisonLayer instead
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000386table GreaterLayer {
387 base:LayerBase;
388}
389
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000390table InputLayer {
391 base:BindableLayerBase;
392}
393
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100394table InstanceNormalizationLayer {
395 base:LayerBase;
396 descriptor:InstanceNormalizationDescriptor;
397}
398
399table InstanceNormalizationDescriptor {
400 gamma:float;
401 beta:float;
402 eps:float;
403 dataLayout:DataLayout;
404}
405
Sadik Armagan26257852019-10-14 13:00:47 +0100406table LogSoftmaxLayer {
407 base:LayerBase;
408 descriptor:LogSoftmaxDescriptor;
409}
410
411table LogSoftmaxDescriptor {
412 beta:float = 1;
413 axis:int = -1;
414}
415
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000416table L2NormalizationLayer {
417 base:LayerBase;
418 descriptor:L2NormalizationDescriptor;
419}
420
421table L2NormalizationDescriptor {
422 dataLayout:DataLayout = NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100423 eps:float = 1e-12;
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000424}
425
James Conroyaba90cd2020-11-06 16:28:18 +0000426enum LogicalBinaryOperation : byte {
427 LogicalAnd = 0,
428 LogicalOr = 1
429}
430
431table LogicalBinaryDescriptor {
432 operation:LogicalBinaryOperation;
433}
434
435table LogicalBinaryLayer {
436 base:LayerBase;
437 descriptor:LogicalBinaryDescriptor;
438}
439
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000440table MinimumLayer {
441 base:LayerBase;
442}
443
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000444table MaximumLayer {
445 base:LayerBase;
446}
447
Sadik Armagan5f450272019-02-12 14:31:45 +0000448table MultiplicationLayer {
449 base:LayerBase;
450}
451
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000452table Pooling2dLayer {
453 base:LayerBase;
454 descriptor:Pooling2dDescriptor;
455}
456
Tamas Nyirid998a1c2021-11-05 14:55:33 +0000457table Pooling3dLayer {
458 base:LayerBase;
459 descriptor:Pooling3dDescriptor;
460}
461
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000462enum PoolingAlgorithm : byte {
463 Max = 0,
464 Average = 1,
465 L2 = 2
466}
467
468enum OutputShapeRounding : byte {
469 Floor = 0,
470 Ceiling = 1
471}
472
473enum PaddingMethod : byte {
474 IgnoreValue = 0,
475 Exclude = 1
476}
477
478table Pooling2dDescriptor {
479 poolType:PoolingAlgorithm;
480 padLeft:uint;
481 padRight:uint;
482 padTop:uint;
483 padBottom:uint;
484 poolWidth:uint;
485 poolHeight:uint;
486 strideX:uint;
487 strideY:uint;
488 outputShapeRounding:OutputShapeRounding;
489 paddingMethod:PaddingMethod;
490 dataLayout:DataLayout;
491}
492
Tamas Nyirid998a1c2021-11-05 14:55:33 +0000493table Pooling3dDescriptor {
494 poolType:PoolingAlgorithm;
495 padLeft:uint;
496 padRight:uint;
497 padTop:uint;
498 padBottom:uint;
499 padFront:uint;
500 padBack:uint;
501 poolWidth:uint;
502 poolHeight:uint;
503 poolDepth:uint;
504 strideX:uint;
505 strideY:uint;
506 strideZ:uint;
507 outputShapeRounding:OutputShapeRounding;
508 paddingMethod:PaddingMethod;
509 dataLayout:DataLayout;
510}
511
Derek Lamberti87acb272019-03-27 16:51:31 +0000512table QuantizeLayer {
513 base:LayerBase;
514}
515
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000516table SoftmaxLayer {
517 base:LayerBase;
518 descriptor:SoftmaxDescriptor;
519}
520
521table SoftmaxDescriptor {
522 beta:float;
Sadik Armaganfd0cae32021-11-08 17:18:31 +0000523 axis:int = -1;
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000524}
525
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000526table DepthwiseConvolution2dLayer {
527 base:LayerBase;
528 descriptor:DepthwiseConvolution2dDescriptor;
529 weights:ConstTensor;
530 biases:ConstTensor;
531}
532
533table DepthwiseConvolution2dDescriptor {
534 padLeft:uint;
535 padRight:uint;
536 padTop:uint;
537 padBottom:uint;
538 strideX:uint;
539 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100540 dilationX:uint = 1;
541 dilationY:uint = 1;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000542 biasEnabled:bool = false;
543 dataLayout:DataLayout = NCHW;
544}
545
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000546table OutputLayer {
547 base:BindableLayerBase;
548}
549
Saoirse Stewart263829c2019-02-19 15:54:14 +0000550table ReshapeLayer {
551 base:LayerBase;
552 descriptor:ReshapeDescriptor;
553}
554
555table ReshapeDescriptor {
Keith Davis3ae3f972021-05-21 16:33:48 +0100556 targetShape:[uint];
Saoirse Stewart263829c2019-02-19 15:54:14 +0000557}
558
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000559table PermuteLayer {
560 base:LayerBase;
561 descriptor:PermuteDescriptor;
562}
563
564table PermuteDescriptor {
565 dimMappings:[uint];
566}
567
Keith Davis3ae3f972021-05-21 16:33:48 +0100568table ShapeLayer {
569 base:LayerBase;
570}
571
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000572table SpaceToBatchNdLayer {
573 base:LayerBase;
574 descriptor:SpaceToBatchNdDescriptor;
575}
576
577table SpaceToBatchNdDescriptor {
578 blockShape:[uint];
579 padList:[uint];
580 dataLayout:DataLayout;
581}
582
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100583table SpaceToDepthLayer {
584 base:LayerBase;
585 descriptor:SpaceToDepthDescriptor;
586}
587
588table SpaceToDepthDescriptor {
589 blockSize:uint;
590 dataLayout:DataLayout;
591}
592
Conor Kennedyda1f9752019-03-01 14:37:12 +0000593table SubtractionLayer {
594 base:LayerBase;
595}
596
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000597table BatchToSpaceNdLayer {
598 base:LayerBase;
599 descriptor:BatchToSpaceNdDescriptor;
600}
601
602table BatchToSpaceNdDescriptor {
603 blockShape:[uint];
604 crops:[uint];
605 dataLayout:DataLayout;
606}
607
Nina Drozd57728782019-02-27 10:53:27 +0000608enum NormalizationAlgorithmChannel : byte {
609 Across = 0,
610 Within = 1
611}
612
613enum NormalizationAlgorithmMethod : byte {
614 LocalBrightness = 0,
615 LocalContrast = 1
616}
617
618table NormalizationLayer {
619 base:LayerBase;
620 descriptor:NormalizationDescriptor;
621}
622
623table NormalizationDescriptor {
624 normChannelType:NormalizationAlgorithmChannel = Across;
625 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
626 normSize:uint;
627 alpha:float;
628 beta:float;
629 k:float;
630 dataLayout:DataLayout = NCHW;
631}
632
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000633table MeanLayer {
634 base:LayerBase;
635 descriptor:MeanDescriptor;
636}
637
638table MeanDescriptor {
639 axis:[uint];
640 keepDims:bool = false;
641}
642
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000643table PadLayer {
644 base:LayerBase;
645 descriptor:PadDescriptor;
646}
647
Matthew Sloyan2e5d0b22021-10-21 14:05:31 +0100648enum PaddingMode : byte {
649 Constant = 0,
650 Reflect = 1,
651 Symmetric = 2
652}
653
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000654table PadDescriptor {
655 padList:[uint];
David Monahan34757812019-06-19 11:47:21 +0100656 padValue:float = 0;
Matthew Sloyan2e5d0b22021-10-21 14:05:31 +0100657 paddingMode:PaddingMode = Constant;
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000658}
659
josh minor4a3c6102020-01-06 16:40:46 -0600660/// @deprecated Use ElementwiseUnaryLayer instead
Sadik Armagan8b42a382019-03-01 14:24:49 +0000661table RsqrtLayer {
662 base:LayerBase;
663}
664
ruoyan018e7fa232019-02-28 15:09:07 +0000665table BatchNormalizationLayer {
666 base:LayerBase;
667 descriptor:BatchNormalizationDescriptor;
668 mean:ConstTensor;
669 variance:ConstTensor;
670 beta:ConstTensor;
671 gamma:ConstTensor;
672}
673
674table BatchNormalizationDescriptor {
675 eps:float;
676 dataLayout:DataLayout;
677}
678
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100679/// @deprecated Use ResizeLayer instead
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000680table ResizeBilinearLayer {
681 base:LayerBase;
682 descriptor:ResizeBilinearDescriptor;
683}
684
685table ResizeBilinearDescriptor {
686 targetWidth:uint;
687 targetHeight:uint;
688 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100689 alignCorners:bool;
690 halfPixelCenters:bool;
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000691}
692
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100693table SliceLayer {
694 base:LayerBase;
695 descriptor:SliceDescriptor;
696}
697
698table SliceDescriptor {
699 begin:[uint];
700 size:[uint];
701}
702
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000703table StridedSliceLayer {
704 base:LayerBase;
705 descriptor:StridedSliceDescriptor;
706}
707
708table StridedSliceDescriptor {
709 begin:[int];
710 end:[int];
711 stride:[int];
712 beginMask:int;
713 endMask:int;
714 shrinkAxisMask:int;
715 ellipsisMask:int;
716 newAxisMask:int;
717 dataLayout:DataLayout;
718}
719
Jim Flynne242f2d2019-05-22 14:24:13 +0100720table ConcatLayer {
721 base:LayerBase;
722 descriptor:OriginsDescriptor;
723}
724
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100725/// @deprecated Use ConcatLayer instead
Jim Flynnac25a1b2019-02-28 10:40:49 +0000726table MergerLayer {
727 base:LayerBase;
728 descriptor:OriginsDescriptor;
729}
730
731table UintVector {
732 data:[uint];
733}
734
735table OriginsDescriptor {
736 concatAxis:uint;
737 numViews:uint;
738 numDimensions:uint;
739 viewOrigins:[UintVector];
740}
741
Jim Flynn18ce3382019-03-08 11:08:30 +0000742table ViewsDescriptor {
743 origins:OriginsDescriptor;
744 viewSizes:[UintVector];
745}
746
747table SplitterLayer {
748 base:LayerBase;
749 descriptor:ViewsDescriptor;
750}
751
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000752table DetectionPostProcessLayer {
753 base:LayerBase;
754 descriptor:DetectionPostProcessDescriptor;
755 anchors:ConstTensor;
756}
757
758table DetectionPostProcessDescriptor {
759 maxDetections:uint;
760 maxClassesPerDetection:uint;
761 detectionsPerClass:uint;
762 nmsScoreThreshold:float;
763 nmsIouThreshold:float;
764 numClasses:uint;
765 useRegularNms:bool;
766 scaleX:float;
767 scaleY:float;
768 scaleW:float;
769 scaleH:float;
770}
771
Jim Flynn11af3752019-03-19 17:22:29 +0000772table LstmInputParams {
773 inputToForgetWeights:ConstTensor;
774 inputToCellWeights:ConstTensor;
775 inputToOutputWeights:ConstTensor;
776 recurrentToForgetWeights:ConstTensor;
777 recurrentToCellWeights:ConstTensor;
778 recurrentToOutputWeights:ConstTensor;
779 forgetGateBias:ConstTensor;
780 cellBias:ConstTensor;
781 outputGateBias:ConstTensor;
782
783 inputToInputWeights:ConstTensor;
784 recurrentToInputWeights:ConstTensor;
785 cellToInputWeights:ConstTensor;
786 inputGateBias:ConstTensor;
787
788 projectionWeights:ConstTensor;
789 projectionBias:ConstTensor;
790
791 cellToForgetWeights:ConstTensor;
792 cellToOutputWeights:ConstTensor;
Jan Eilersf8c62972019-07-17 11:07:49 +0100793
794 inputLayerNormWeights:ConstTensor;
795 forgetLayerNormWeights:ConstTensor;
796 cellLayerNormWeights:ConstTensor;
797 outputLayerNormWeights:ConstTensor;
Jim Flynn11af3752019-03-19 17:22:29 +0000798}
799
James Conroy8d333182020-05-13 10:27:58 +0100800table LstmDescriptor {
801 activationFunc:uint;
802 clippingThresCell:float;
803 clippingThresProj:float;
804 cifgEnabled:bool = true;
805 peepholeEnabled:bool = false;
806 projectionEnabled:bool = false;
807 layerNormEnabled:bool = false;
808}
809
810table LstmLayer {
811 base:LayerBase;
812 descriptor:LstmDescriptor;
813 inputParams:LstmInputParams;
814}
815
816table QLstmInputParams {
817 // Mandatory
818 inputToForgetWeights:ConstTensor;
819 inputToCellWeights:ConstTensor;
820 inputToOutputWeights:ConstTensor;
821
822 recurrentToForgetWeights:ConstTensor;
823 recurrentToCellWeights:ConstTensor;
824 recurrentToOutputWeights:ConstTensor;
825
826 forgetGateBias:ConstTensor;
827 cellBias:ConstTensor;
828 outputGateBias:ConstTensor;
829
830 // CIFG
831 inputToInputWeights:ConstTensor;
832 recurrentToInputWeights:ConstTensor;
833 inputGateBias:ConstTensor;
834
835 // Projection
836 projectionWeights:ConstTensor;
837 projectionBias:ConstTensor;
838
839 // Peephole
840 cellToInputWeights:ConstTensor;
841 cellToForgetWeights:ConstTensor;
842 cellToOutputWeights:ConstTensor;
843
844 // Layer norm
845 inputLayerNormWeights:ConstTensor;
846 forgetLayerNormWeights:ConstTensor;
847 cellLayerNormWeights:ConstTensor;
848 outputLayerNormWeights:ConstTensor;
849}
850
851table QLstmDescriptor {
852 cifgEnabled:bool = true;
853 peepholeEnabled:bool = false;
854 projectionEnabled:bool = false;
855 layerNormEnabled:bool = false;
856
857 cellClip:float;
858 projectionClip:float;
859
860 inputIntermediateScale:float;
861 forgetIntermediateScale:float;
862 cellIntermediateScale:float;
863 outputIntermediateScale:float;
864
865 hiddenStateZeroPoint:int;
866 hiddenStateScale:float;
867}
868
869table QLstmLayer {
870 base:LayerBase;
871 descriptor:QLstmDescriptor;
872 inputParams:QLstmInputParams;
873}
874
Jan Eilers5b01a892019-07-23 09:47:43 +0100875table QuantizedLstmInputParams {
876 inputToInputWeights:ConstTensor;
877 inputToForgetWeights:ConstTensor;
878 inputToCellWeights:ConstTensor;
879 inputToOutputWeights:ConstTensor;
880
881 recurrentToInputWeights:ConstTensor;
882 recurrentToForgetWeights:ConstTensor;
883 recurrentToCellWeights:ConstTensor;
884 recurrentToOutputWeights:ConstTensor;
885
886 inputGateBias:ConstTensor;
887 forgetGateBias:ConstTensor;
888 cellBias:ConstTensor;
889 outputGateBias:ConstTensor;
890}
891
Jan Eilers5b01a892019-07-23 09:47:43 +0100892table QuantizedLstmLayer {
893 base:LayerBase;
894 inputParams:QuantizedLstmInputParams;
895}
896
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000897table DequantizeLayer {
898 base:LayerBase;
899}
900
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100901table MergeLayer {
902 base:LayerBase;
903}
904
Sadik Armaganeff363d2019-04-05 15:25:46 +0100905table SwitchLayer {
906 base:LayerBase;
907}
908
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100909table PreluLayer {
910 base:LayerBase;
911}
912
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100913table TransposeConvolution2dLayer {
914 base:LayerBase;
915 descriptor:TransposeConvolution2dDescriptor;
916 weights:ConstTensor;
917 biases:ConstTensor;
918}
919
920table TransposeConvolution2dDescriptor {
921 padLeft:uint;
922 padRight:uint;
923 padTop:uint;
924 padBottom:uint;
925 strideX:uint;
926 strideY:uint;
927 biasEnabled:bool = false;
928 dataLayout:DataLayout = NCHW;
929}
930
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000931table TransposeLayer {
932 base:LayerBase;
933 descriptor:TransposeDescriptor;
934}
935
936table TransposeDescriptor {
937 dimMappings:[uint];
938}
939
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100940table ResizeLayer {
941 base:LayerBase;
942 descriptor:ResizeDescriptor;
943}
944
945table ResizeDescriptor {
946 targetHeight:uint;
947 targetWidth:uint;
948 method:ResizeMethod = NearestNeighbor;
949 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100950 alignCorners:bool;
951 halfPixelCenters:bool;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100952}
953
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100954table StackLayer {
955 base:LayerBase;
956 descriptor:StackDescriptor;
957}
958
959table StackDescriptor {
960 axis:uint;
961 numInputs:uint;
962 inputShape:[uint];
963}
964
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100965table StandInDescriptor {
966 numInputs:uint;
967 numOutputs:uint;
968}
969
970table StandInLayer {
971 base:LayerBase;
972 descriptor:StandInDescriptor;
973}
974
Finn Williams2605b232020-06-10 15:53:46 +0100975table RankLayer {
976 base:LayerBase;
977}
978
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000979table ReduceLayer {
980 base:LayerBase;
981 descriptor:ReduceDescriptor;
982}
983
984table ReduceDescriptor {
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000985 keepDims:bool = false;
986 axis:[uint];
987 reduceOperation:ReduceOperation = Sum;
988}
989
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100990table UnidirectionalSequenceLstmDescriptor {
991 activationFunc:uint;
992 clippingThresCell:float;
993 clippingThresProj:float;
994 cifgEnabled:bool = true;
995 peepholeEnabled:bool = false;
996 projectionEnabled:bool = false;
997 layerNormEnabled:bool = false;
998 timeMajor:bool = false;
999}
1000
1001table UnidirectionalSequenceLstmLayer {
1002 base:LayerBase;
1003 descriptor:UnidirectionalSequenceLstmDescriptor;
1004 inputParams:LstmInputParams;
1005}
1006
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001007union Layer {
Mike Kellyaf484012019-02-20 16:53:11 +00001008 ActivationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001009 AdditionLayer,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +00001010 BatchToSpaceNdLayer,
ruoyan018e7fa232019-02-28 15:09:07 +00001011 BatchNormalizationLayer,
Conor Kennedy76277882019-02-26 08:29:54 +00001012 ConstantLayer,
Mike Kellya0766c32019-02-19 17:22:07 +00001013 Convolution2dLayer,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +00001014 DepthwiseConvolution2dLayer,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +00001015 FullyConnectedLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001016 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +00001017 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +00001018 OutputLayer,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +00001019 PermuteLayer,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +00001020 Pooling2dLayer,
Saoirse Stewart263829c2019-02-19 15:54:14 +00001021 ReshapeLayer,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +00001022 SoftmaxLayer,
Éanna Ó Catháin58885892019-02-27 16:16:39 +00001023 SpaceToBatchNdLayer,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +00001024 DivisionLayer,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +00001025 MinimumLayer,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +00001026 EqualLayer,
Nina Drozd57728782019-02-27 10:53:27 +00001027 MaximumLayer,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +00001028 NormalizationLayer,
Sadik Armagan8b42a382019-03-01 14:24:49 +00001029 PadLayer,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +00001030 RsqrtLayer,
Conor Kennedy79ffdf52019-03-01 14:24:54 +00001031 FloorLayer,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +00001032 GreaterLayer,
Conor Kennedyda1f9752019-03-01 14:37:12 +00001033 ResizeBilinearLayer,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +00001034 SubtractionLayer,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +00001035 StridedSliceLayer,
Sadik Armaganac97c8c2019-03-04 17:44:21 +00001036 GatherLayer,
Jim Flynnac25a1b2019-02-28 10:40:49 +00001037 MeanLayer,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +00001038 MergerLayer,
Jim Flynn18ce3382019-03-08 11:08:30 +00001039 L2NormalizationLayer,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00001040 SplitterLayer,
Jim Flynn11af3752019-03-19 17:22:29 +00001041 DetectionPostProcessLayer,
Derek Lamberti87acb272019-03-27 16:51:31 +00001042 LstmLayer,
Jan Eilers5b01a892019-07-23 09:47:43 +01001043 QuantizedLstmLayer,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +00001044 QuantizeLayer,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +01001045 DequantizeLayer,
Sadik Armaganeff363d2019-04-05 15:25:46 +01001046 MergeLayer,
Jim Flynne242f2d2019-05-22 14:24:13 +01001047 SwitchLayer,
Aron Virginas-Taraa067142019-06-11 16:01:44 +01001048 ConcatLayer,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +01001049 SpaceToDepthLayer,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +01001050 PreluLayer,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +01001051 TransposeConvolution2dLayer,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +01001052 ResizeLayer,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +01001053 StackLayer,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +01001054 AbsLayer,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +01001055 ArgMinMaxLayer,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +01001056 SliceLayer,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +01001057 DepthToSpaceLayer,
Sadik Armagan26257852019-10-14 13:00:47 +01001058 InstanceNormalizationLayer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001059 LogSoftmaxLayer,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +01001060 ComparisonLayer,
josh minor4a3c6102020-01-06 16:40:46 -06001061 StandInLayer,
Mike Kellyc9ea45a2020-02-28 18:11:58 +00001062 ElementwiseUnaryLayer,
James Conroy8d333182020-05-13 10:27:58 +01001063 TransposeLayer,
Keith Davis300ad562020-06-04 16:34:23 +01001064 QLstmLayer,
Finn Williams2605b232020-06-10 15:53:46 +01001065 FillLayer,
James Conroyaba90cd2020-11-06 16:28:18 +00001066 RankLayer,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +00001067 LogicalBinaryLayer,
mathad01b392e982021-04-07 12:07:30 +01001068 ReduceLayer,
Keith Davis3ae3f972021-05-21 16:33:48 +01001069 CastLayer,
Narumol Prangnawarata0162e12021-07-23 14:47:49 +01001070 ShapeLayer,
1071 UnidirectionalSequenceLstmLayer,
Simon Obute51f67772021-09-03 15:50:13 +01001072 ChannelShuffleLayer,
Matthew Sloyanb63a3112021-09-08 13:05:51 +01001073 Convolution3dLayer,
Tamas Nyirid998a1c2021-11-05 14:55:33 +00001074 Pooling3dLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001075}
1076
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001077table AnyLayer {
1078 layer:Layer;
1079}
1080
Tee Jungaa920c52019-11-05 10:48:25 +00001081table FeatureCompatibilityVersions {
1082 bindingIdsScheme:uint = 0;
Jan Eilers53ef7952021-06-02 12:01:25 +01001083 weightsLayoutScheme:uint = 0;
Matthew Sloyan81beae32021-07-13 19:46:11 +01001084 constantTensorsAsInputs:uint = 0;
Tee Jungaa920c52019-11-05 10:48:25 +00001085}
1086
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001087// Root type for serialized data is the graph of the network
1088table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001089 layers:[AnyLayer];
Tee Jungaa920c52019-11-05 10:48:25 +00001090 inputIds:[int];
1091 outputIds:[int];
1092 featureVersions:FeatureCompatibilityVersions;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001093}
1094
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +00001095root_type SerializedGraph;