blob: f301fce818f81cdfd18acda07fed04bcb3ded80e [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,
Teresa Charlin6966bfa2022-04-25 17:14:50 +0100184 GatherNd = 67,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000185}
186
187// Base layer table to be used as part of other layers
188table LayerBase {
189 index:uint;
190 layerName:string;
191 layerType:LayerType;
192 inputSlots:[InputSlot];
193 outputSlots:[OutputSlot];
194}
195
196table BindableLayerBase {
197 base:LayerBase;
198 layerBindingId:int;
199}
200
201// Table for each layer defined below
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100202
josh minor4a3c6102020-01-06 16:40:46 -0600203/// @deprecated Use ElementwiseUnaryLayer instead
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100204table AbsLayer {
205 base:LayerBase;
206}
207
Mike Kellyaf484012019-02-20 16:53:11 +0000208table ActivationLayer {
209 base:LayerBase;
210 descriptor:ActivationDescriptor;
211}
212
213table ActivationDescriptor {
Tee Jung86bc3d82019-10-01 11:25:56 +0900214 activationFunction:ActivationFunction = Sigmoid;
Mike Kellyaf484012019-02-20 16:53:11 +0000215 a:float;
216 b:float;
217}
218
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000219table AdditionLayer {
220 base:LayerBase;
221}
222
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100223table ArgMinMaxLayer {
224 base:LayerBase;
225 descriptor:ArgMinMaxDescriptor;
226}
227
228table ArgMinMaxDescriptor{
Tee Jung86bc3d82019-10-01 11:25:56 +0900229 argMinMaxFunction:ArgMinMaxFunction;
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100230 axis:int;
231}
232
mathad01b392e982021-04-07 12:07:30 +0100233table CastLayer {
234 base:LayerBase;
235}
236
Simon Obute51f67772021-09-03 15:50:13 +0100237table ChannelShuffleLayer {
238 base:LayerBase;
239 descriptor:ChannelShuffleDescriptor;
240}
241
242table ChannelShuffleDescriptor {
243 axis:uint = 0;
244 numGroups:uint = 0;
245}
246
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100247enum ComparisonOperation : byte {
248 Equal = 0,
249 Greater = 1,
250 GreaterOrEqual = 2,
251 Less = 3,
252 LessOrEqual = 4,
253 NotEqual = 5
254}
255
256table ComparisonDescriptor {
257 operation:ComparisonOperation;
258}
259
260table ComparisonLayer {
261 base:LayerBase;
262 descriptor:ComparisonDescriptor;
263}
264
Conor Kennedy76277882019-02-26 08:29:54 +0000265table ConstantLayer {
266 base:LayerBase;
267 input:ConstTensor;
268}
269
Mike Kellya0766c32019-02-19 17:22:07 +0000270table Convolution2dLayer {
271 base:LayerBase;
272 descriptor:Convolution2dDescriptor;
273 weights:ConstTensor;
274 biases:ConstTensor;
275}
276
277table Convolution2dDescriptor {
278 padLeft:uint;
279 padRight:uint;
280 padTop:uint;
281 padBottom:uint;
282 strideX:uint;
283 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100284 dilationX:uint = 1;
285 dilationY:uint = 1;
Mike Kellya0766c32019-02-19 17:22:07 +0000286 biasEnabled:bool = false;
287 dataLayout:DataLayout = NCHW;
288}
289
Matthew Sloyanb63a3112021-09-08 13:05:51 +0100290table Convolution3dLayer {
291 base:LayerBase;
292 descriptor:Convolution3dDescriptor;
Matthew Sloyanb63a3112021-09-08 13:05:51 +0100293}
294
295table Convolution3dDescriptor {
296 padLeft:uint;
297 padRight:uint;
298 padTop:uint;
299 padBottom:uint;
300 padFront:uint;
301 padBack:uint;
302 strideX:uint;
303 strideY:uint;
304 strideZ:uint;
305 dilationX:uint = 1;
306 dilationY:uint = 1;
307 dilationZ:uint = 1;
308 biasEnabled:bool = false;
309 dataLayout:DataLayout = NDHWC;
310}
311
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100312table DepthToSpaceLayer {
313 base:LayerBase;
314 descriptor:DepthToSpaceDescriptor;
315}
316
317table DepthToSpaceDescriptor {
318 blockSize:uint;
319 dataLayout:DataLayout;
320}
321
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000322table DivisionLayer {
323 base:LayerBase;
324}
325
josh minor4a3c6102020-01-06 16:40:46 -0600326enum UnaryOperation : byte {
327 Abs = 0,
328 Rsqrt = 1,
329 Sqrt = 2,
330 Exp = 3,
James Conroyaba90cd2020-11-06 16:28:18 +0000331 Neg = 4,
Teresa Charlin50de4fa2021-05-31 18:47:33 +0100332 LogicalNot = 5,
333 Log = 6,
334 Sin = 7
josh minor4a3c6102020-01-06 16:40:46 -0600335}
336
337table ElementwiseUnaryDescriptor {
338 operation:UnaryOperation;
339}
340
341table ElementwiseUnaryLayer {
342 base:LayerBase;
343 descriptor:ElementwiseUnaryDescriptor;
344}
345
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100346/// @deprecated Use ComparisonLayer instead
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000347table EqualLayer {
348 base:LayerBase;
349}
350
Keith Davis300ad562020-06-04 16:34:23 +0100351table FillLayer {
352 base:LayerBase;
353 descriptor:FillDescriptor;
354}
355
356table FillDescriptor {
357 value:float;
358}
359
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000360table FloorLayer{
361 base:LayerBase;
362}
363
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000364table FullyConnectedLayer {
365 base:LayerBase;
366 descriptor:FullyConnectedDescriptor;
Matthew Sloyan81beae32021-07-13 19:46:11 +0100367 weights:ConstTensor; // ConstTensors are now passed as inputs.
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000368 biases:ConstTensor;
369}
370
371table FullyConnectedDescriptor {
372 biasEnabled:bool = false;
373 transposeWeightsMatrix:bool = false;
Sadik Armaganf0a6dec2021-03-25 07:46:55 +0000374 constantWeights:bool = true;
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000375}
376
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000377table GatherLayer {
378 base:LayerBase;
Teresa Charlin52664732020-06-29 16:27:03 +0100379 descriptor:GatherDescriptor;
380}
381
382table GatherDescriptor {
383 axis:int = 0;
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000384}
385
Teresa Charlin6966bfa2022-04-25 17:14:50 +0100386table GatherNdLayer {
387 base:LayerBase;
388}
389
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100390/// @deprecated Use ComparisonLayer instead
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000391table GreaterLayer {
392 base:LayerBase;
393}
394
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000395table InputLayer {
396 base:BindableLayerBase;
397}
398
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100399table InstanceNormalizationLayer {
400 base:LayerBase;
401 descriptor:InstanceNormalizationDescriptor;
402}
403
404table InstanceNormalizationDescriptor {
405 gamma:float;
406 beta:float;
407 eps:float;
408 dataLayout:DataLayout;
409}
410
Sadik Armagan26257852019-10-14 13:00:47 +0100411table LogSoftmaxLayer {
412 base:LayerBase;
413 descriptor:LogSoftmaxDescriptor;
414}
415
416table LogSoftmaxDescriptor {
417 beta:float = 1;
418 axis:int = -1;
419}
420
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000421table L2NormalizationLayer {
422 base:LayerBase;
423 descriptor:L2NormalizationDescriptor;
424}
425
426table L2NormalizationDescriptor {
427 dataLayout:DataLayout = NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100428 eps:float = 1e-12;
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000429}
430
James Conroyaba90cd2020-11-06 16:28:18 +0000431enum LogicalBinaryOperation : byte {
432 LogicalAnd = 0,
433 LogicalOr = 1
434}
435
436table LogicalBinaryDescriptor {
437 operation:LogicalBinaryOperation;
438}
439
440table LogicalBinaryLayer {
441 base:LayerBase;
442 descriptor:LogicalBinaryDescriptor;
443}
444
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000445table MinimumLayer {
446 base:LayerBase;
447}
448
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000449table MaximumLayer {
450 base:LayerBase;
451}
452
Sadik Armagan5f450272019-02-12 14:31:45 +0000453table MultiplicationLayer {
454 base:LayerBase;
455}
456
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000457table Pooling2dLayer {
458 base:LayerBase;
459 descriptor:Pooling2dDescriptor;
460}
461
Tamas Nyirid998a1c2021-11-05 14:55:33 +0000462table Pooling3dLayer {
463 base:LayerBase;
464 descriptor:Pooling3dDescriptor;
465}
466
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000467enum PoolingAlgorithm : byte {
468 Max = 0,
469 Average = 1,
470 L2 = 2
471}
472
473enum OutputShapeRounding : byte {
474 Floor = 0,
475 Ceiling = 1
476}
477
478enum PaddingMethod : byte {
479 IgnoreValue = 0,
480 Exclude = 1
481}
482
483table Pooling2dDescriptor {
484 poolType:PoolingAlgorithm;
485 padLeft:uint;
486 padRight:uint;
487 padTop:uint;
488 padBottom:uint;
489 poolWidth:uint;
490 poolHeight:uint;
491 strideX:uint;
492 strideY:uint;
493 outputShapeRounding:OutputShapeRounding;
494 paddingMethod:PaddingMethod;
495 dataLayout:DataLayout;
496}
497
Tamas Nyirid998a1c2021-11-05 14:55:33 +0000498table Pooling3dDescriptor {
499 poolType:PoolingAlgorithm;
500 padLeft:uint;
501 padRight:uint;
502 padTop:uint;
503 padBottom:uint;
504 padFront:uint;
505 padBack:uint;
506 poolWidth:uint;
507 poolHeight:uint;
508 poolDepth:uint;
509 strideX:uint;
510 strideY:uint;
511 strideZ:uint;
512 outputShapeRounding:OutputShapeRounding;
513 paddingMethod:PaddingMethod;
514 dataLayout:DataLayout;
515}
516
Derek Lamberti87acb272019-03-27 16:51:31 +0000517table QuantizeLayer {
518 base:LayerBase;
519}
520
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000521table SoftmaxLayer {
522 base:LayerBase;
523 descriptor:SoftmaxDescriptor;
524}
525
526table SoftmaxDescriptor {
527 beta:float;
Sadik Armaganfd0cae32021-11-08 17:18:31 +0000528 axis:int = -1;
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000529}
530
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000531table DepthwiseConvolution2dLayer {
532 base:LayerBase;
533 descriptor:DepthwiseConvolution2dDescriptor;
534 weights:ConstTensor;
535 biases:ConstTensor;
536}
537
538table DepthwiseConvolution2dDescriptor {
539 padLeft:uint;
540 padRight:uint;
541 padTop:uint;
542 padBottom:uint;
543 strideX:uint;
544 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100545 dilationX:uint = 1;
546 dilationY:uint = 1;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000547 biasEnabled:bool = false;
548 dataLayout:DataLayout = NCHW;
549}
550
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000551table OutputLayer {
552 base:BindableLayerBase;
553}
554
Saoirse Stewart263829c2019-02-19 15:54:14 +0000555table ReshapeLayer {
556 base:LayerBase;
557 descriptor:ReshapeDescriptor;
558}
559
560table ReshapeDescriptor {
Keith Davis3ae3f972021-05-21 16:33:48 +0100561 targetShape:[uint];
Saoirse Stewart263829c2019-02-19 15:54:14 +0000562}
563
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000564table PermuteLayer {
565 base:LayerBase;
566 descriptor:PermuteDescriptor;
567}
568
569table PermuteDescriptor {
570 dimMappings:[uint];
571}
572
Keith Davis3ae3f972021-05-21 16:33:48 +0100573table ShapeLayer {
574 base:LayerBase;
575}
576
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000577table SpaceToBatchNdLayer {
578 base:LayerBase;
579 descriptor:SpaceToBatchNdDescriptor;
580}
581
582table SpaceToBatchNdDescriptor {
583 blockShape:[uint];
584 padList:[uint];
585 dataLayout:DataLayout;
586}
587
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100588table SpaceToDepthLayer {
589 base:LayerBase;
590 descriptor:SpaceToDepthDescriptor;
591}
592
593table SpaceToDepthDescriptor {
594 blockSize:uint;
595 dataLayout:DataLayout;
596}
597
Conor Kennedyda1f9752019-03-01 14:37:12 +0000598table SubtractionLayer {
599 base:LayerBase;
600}
601
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000602table BatchToSpaceNdLayer {
603 base:LayerBase;
604 descriptor:BatchToSpaceNdDescriptor;
605}
606
607table BatchToSpaceNdDescriptor {
608 blockShape:[uint];
609 crops:[uint];
610 dataLayout:DataLayout;
611}
612
Nina Drozd57728782019-02-27 10:53:27 +0000613enum NormalizationAlgorithmChannel : byte {
614 Across = 0,
615 Within = 1
616}
617
618enum NormalizationAlgorithmMethod : byte {
619 LocalBrightness = 0,
620 LocalContrast = 1
621}
622
623table NormalizationLayer {
624 base:LayerBase;
625 descriptor:NormalizationDescriptor;
626}
627
628table NormalizationDescriptor {
629 normChannelType:NormalizationAlgorithmChannel = Across;
630 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
631 normSize:uint;
632 alpha:float;
633 beta:float;
634 k:float;
635 dataLayout:DataLayout = NCHW;
636}
637
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000638table MeanLayer {
639 base:LayerBase;
640 descriptor:MeanDescriptor;
641}
642
643table MeanDescriptor {
644 axis:[uint];
645 keepDims:bool = false;
646}
647
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000648table PadLayer {
649 base:LayerBase;
650 descriptor:PadDescriptor;
651}
652
Matthew Sloyan2e5d0b22021-10-21 14:05:31 +0100653enum PaddingMode : byte {
654 Constant = 0,
655 Reflect = 1,
656 Symmetric = 2
657}
658
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000659table PadDescriptor {
660 padList:[uint];
David Monahan34757812019-06-19 11:47:21 +0100661 padValue:float = 0;
Matthew Sloyan2e5d0b22021-10-21 14:05:31 +0100662 paddingMode:PaddingMode = Constant;
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000663}
664
josh minor4a3c6102020-01-06 16:40:46 -0600665/// @deprecated Use ElementwiseUnaryLayer instead
Sadik Armagan8b42a382019-03-01 14:24:49 +0000666table RsqrtLayer {
667 base:LayerBase;
668}
669
ruoyan018e7fa232019-02-28 15:09:07 +0000670table BatchNormalizationLayer {
671 base:LayerBase;
672 descriptor:BatchNormalizationDescriptor;
673 mean:ConstTensor;
674 variance:ConstTensor;
675 beta:ConstTensor;
676 gamma:ConstTensor;
677}
678
679table BatchNormalizationDescriptor {
680 eps:float;
681 dataLayout:DataLayout;
682}
683
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100684/// @deprecated Use ResizeLayer instead
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000685table ResizeBilinearLayer {
686 base:LayerBase;
687 descriptor:ResizeBilinearDescriptor;
688}
689
690table ResizeBilinearDescriptor {
691 targetWidth:uint;
692 targetHeight:uint;
693 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100694 alignCorners:bool;
695 halfPixelCenters:bool;
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000696}
697
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100698table SliceLayer {
699 base:LayerBase;
700 descriptor:SliceDescriptor;
701}
702
703table SliceDescriptor {
704 begin:[uint];
705 size:[uint];
706}
707
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000708table StridedSliceLayer {
709 base:LayerBase;
710 descriptor:StridedSliceDescriptor;
711}
712
713table StridedSliceDescriptor {
714 begin:[int];
715 end:[int];
716 stride:[int];
717 beginMask:int;
718 endMask:int;
719 shrinkAxisMask:int;
720 ellipsisMask:int;
721 newAxisMask:int;
722 dataLayout:DataLayout;
723}
724
Jim Flynne242f2d2019-05-22 14:24:13 +0100725table ConcatLayer {
726 base:LayerBase;
727 descriptor:OriginsDescriptor;
728}
729
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100730/// @deprecated Use ConcatLayer instead
Jim Flynnac25a1b2019-02-28 10:40:49 +0000731table MergerLayer {
732 base:LayerBase;
733 descriptor:OriginsDescriptor;
734}
735
736table UintVector {
737 data:[uint];
738}
739
740table OriginsDescriptor {
741 concatAxis:uint;
742 numViews:uint;
743 numDimensions:uint;
744 viewOrigins:[UintVector];
745}
746
Jim Flynn18ce3382019-03-08 11:08:30 +0000747table ViewsDescriptor {
748 origins:OriginsDescriptor;
749 viewSizes:[UintVector];
750}
751
752table SplitterLayer {
753 base:LayerBase;
754 descriptor:ViewsDescriptor;
755}
756
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000757table DetectionPostProcessLayer {
758 base:LayerBase;
759 descriptor:DetectionPostProcessDescriptor;
760 anchors:ConstTensor;
761}
762
763table DetectionPostProcessDescriptor {
764 maxDetections:uint;
765 maxClassesPerDetection:uint;
766 detectionsPerClass:uint;
767 nmsScoreThreshold:float;
768 nmsIouThreshold:float;
769 numClasses:uint;
770 useRegularNms:bool;
771 scaleX:float;
772 scaleY:float;
773 scaleW:float;
774 scaleH:float;
775}
776
Jim Flynn11af3752019-03-19 17:22:29 +0000777table LstmInputParams {
778 inputToForgetWeights:ConstTensor;
779 inputToCellWeights:ConstTensor;
780 inputToOutputWeights:ConstTensor;
781 recurrentToForgetWeights:ConstTensor;
782 recurrentToCellWeights:ConstTensor;
783 recurrentToOutputWeights:ConstTensor;
784 forgetGateBias:ConstTensor;
785 cellBias:ConstTensor;
786 outputGateBias:ConstTensor;
787
788 inputToInputWeights:ConstTensor;
789 recurrentToInputWeights:ConstTensor;
790 cellToInputWeights:ConstTensor;
791 inputGateBias:ConstTensor;
792
793 projectionWeights:ConstTensor;
794 projectionBias:ConstTensor;
795
796 cellToForgetWeights:ConstTensor;
797 cellToOutputWeights:ConstTensor;
Jan Eilersf8c62972019-07-17 11:07:49 +0100798
799 inputLayerNormWeights:ConstTensor;
800 forgetLayerNormWeights:ConstTensor;
801 cellLayerNormWeights:ConstTensor;
802 outputLayerNormWeights:ConstTensor;
Jim Flynn11af3752019-03-19 17:22:29 +0000803}
804
James Conroy8d333182020-05-13 10:27:58 +0100805table LstmDescriptor {
806 activationFunc:uint;
807 clippingThresCell:float;
808 clippingThresProj:float;
809 cifgEnabled:bool = true;
810 peepholeEnabled:bool = false;
811 projectionEnabled:bool = false;
812 layerNormEnabled:bool = false;
813}
814
815table LstmLayer {
816 base:LayerBase;
817 descriptor:LstmDescriptor;
818 inputParams:LstmInputParams;
819}
820
821table QLstmInputParams {
822 // Mandatory
823 inputToForgetWeights:ConstTensor;
824 inputToCellWeights:ConstTensor;
825 inputToOutputWeights:ConstTensor;
826
827 recurrentToForgetWeights:ConstTensor;
828 recurrentToCellWeights:ConstTensor;
829 recurrentToOutputWeights:ConstTensor;
830
831 forgetGateBias:ConstTensor;
832 cellBias:ConstTensor;
833 outputGateBias:ConstTensor;
834
835 // CIFG
836 inputToInputWeights:ConstTensor;
837 recurrentToInputWeights:ConstTensor;
838 inputGateBias:ConstTensor;
839
840 // Projection
841 projectionWeights:ConstTensor;
842 projectionBias:ConstTensor;
843
844 // Peephole
845 cellToInputWeights:ConstTensor;
846 cellToForgetWeights:ConstTensor;
847 cellToOutputWeights:ConstTensor;
848
849 // Layer norm
850 inputLayerNormWeights:ConstTensor;
851 forgetLayerNormWeights:ConstTensor;
852 cellLayerNormWeights:ConstTensor;
853 outputLayerNormWeights:ConstTensor;
854}
855
856table QLstmDescriptor {
857 cifgEnabled:bool = true;
858 peepholeEnabled:bool = false;
859 projectionEnabled:bool = false;
860 layerNormEnabled:bool = false;
861
862 cellClip:float;
863 projectionClip:float;
864
865 inputIntermediateScale:float;
866 forgetIntermediateScale:float;
867 cellIntermediateScale:float;
868 outputIntermediateScale:float;
869
870 hiddenStateZeroPoint:int;
871 hiddenStateScale:float;
872}
873
874table QLstmLayer {
875 base:LayerBase;
876 descriptor:QLstmDescriptor;
877 inputParams:QLstmInputParams;
878}
879
Jan Eilers5b01a892019-07-23 09:47:43 +0100880table QuantizedLstmInputParams {
881 inputToInputWeights:ConstTensor;
882 inputToForgetWeights:ConstTensor;
883 inputToCellWeights:ConstTensor;
884 inputToOutputWeights:ConstTensor;
885
886 recurrentToInputWeights:ConstTensor;
887 recurrentToForgetWeights:ConstTensor;
888 recurrentToCellWeights:ConstTensor;
889 recurrentToOutputWeights:ConstTensor;
890
891 inputGateBias:ConstTensor;
892 forgetGateBias:ConstTensor;
893 cellBias:ConstTensor;
894 outputGateBias:ConstTensor;
895}
896
Jan Eilers5b01a892019-07-23 09:47:43 +0100897table QuantizedLstmLayer {
898 base:LayerBase;
899 inputParams:QuantizedLstmInputParams;
900}
901
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000902table DequantizeLayer {
903 base:LayerBase;
904}
905
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100906table MergeLayer {
907 base:LayerBase;
908}
909
Sadik Armaganeff363d2019-04-05 15:25:46 +0100910table SwitchLayer {
911 base:LayerBase;
912}
913
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100914table PreluLayer {
915 base:LayerBase;
916}
917
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100918table TransposeConvolution2dLayer {
919 base:LayerBase;
920 descriptor:TransposeConvolution2dDescriptor;
921 weights:ConstTensor;
922 biases:ConstTensor;
923}
924
925table TransposeConvolution2dDescriptor {
926 padLeft:uint;
927 padRight:uint;
928 padTop:uint;
929 padBottom:uint;
930 strideX:uint;
931 strideY:uint;
932 biasEnabled:bool = false;
933 dataLayout:DataLayout = NCHW;
934}
935
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000936table TransposeLayer {
937 base:LayerBase;
938 descriptor:TransposeDescriptor;
939}
940
941table TransposeDescriptor {
942 dimMappings:[uint];
943}
944
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100945table ResizeLayer {
946 base:LayerBase;
947 descriptor:ResizeDescriptor;
948}
949
950table ResizeDescriptor {
951 targetHeight:uint;
952 targetWidth:uint;
953 method:ResizeMethod = NearestNeighbor;
954 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100955 alignCorners:bool;
956 halfPixelCenters:bool;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100957}
958
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100959table StackLayer {
960 base:LayerBase;
961 descriptor:StackDescriptor;
962}
963
964table StackDescriptor {
965 axis:uint;
966 numInputs:uint;
967 inputShape:[uint];
968}
969
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100970table StandInDescriptor {
971 numInputs:uint;
972 numOutputs:uint;
973}
974
975table StandInLayer {
976 base:LayerBase;
977 descriptor:StandInDescriptor;
978}
979
Finn Williams2605b232020-06-10 15:53:46 +0100980table RankLayer {
981 base:LayerBase;
982}
983
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000984table ReduceLayer {
985 base:LayerBase;
986 descriptor:ReduceDescriptor;
987}
988
989table ReduceDescriptor {
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000990 keepDims:bool = false;
991 axis:[uint];
992 reduceOperation:ReduceOperation = Sum;
993}
994
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100995table UnidirectionalSequenceLstmDescriptor {
996 activationFunc:uint;
997 clippingThresCell:float;
998 clippingThresProj:float;
999 cifgEnabled:bool = true;
1000 peepholeEnabled:bool = false;
1001 projectionEnabled:bool = false;
1002 layerNormEnabled:bool = false;
1003 timeMajor:bool = false;
1004}
1005
1006table UnidirectionalSequenceLstmLayer {
1007 base:LayerBase;
1008 descriptor:UnidirectionalSequenceLstmDescriptor;
1009 inputParams:LstmInputParams;
1010}
1011
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001012union Layer {
Mike Kellyaf484012019-02-20 16:53:11 +00001013 ActivationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001014 AdditionLayer,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +00001015 BatchToSpaceNdLayer,
ruoyan018e7fa232019-02-28 15:09:07 +00001016 BatchNormalizationLayer,
Conor Kennedy76277882019-02-26 08:29:54 +00001017 ConstantLayer,
Mike Kellya0766c32019-02-19 17:22:07 +00001018 Convolution2dLayer,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +00001019 DepthwiseConvolution2dLayer,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +00001020 FullyConnectedLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001021 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +00001022 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +00001023 OutputLayer,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +00001024 PermuteLayer,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +00001025 Pooling2dLayer,
Saoirse Stewart263829c2019-02-19 15:54:14 +00001026 ReshapeLayer,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +00001027 SoftmaxLayer,
Éanna Ó Catháin58885892019-02-27 16:16:39 +00001028 SpaceToBatchNdLayer,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +00001029 DivisionLayer,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +00001030 MinimumLayer,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +00001031 EqualLayer,
Nina Drozd57728782019-02-27 10:53:27 +00001032 MaximumLayer,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +00001033 NormalizationLayer,
Sadik Armagan8b42a382019-03-01 14:24:49 +00001034 PadLayer,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +00001035 RsqrtLayer,
Conor Kennedy79ffdf52019-03-01 14:24:54 +00001036 FloorLayer,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +00001037 GreaterLayer,
Conor Kennedyda1f9752019-03-01 14:37:12 +00001038 ResizeBilinearLayer,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +00001039 SubtractionLayer,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +00001040 StridedSliceLayer,
Sadik Armaganac97c8c2019-03-04 17:44:21 +00001041 GatherLayer,
Jim Flynnac25a1b2019-02-28 10:40:49 +00001042 MeanLayer,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +00001043 MergerLayer,
Jim Flynn18ce3382019-03-08 11:08:30 +00001044 L2NormalizationLayer,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00001045 SplitterLayer,
Jim Flynn11af3752019-03-19 17:22:29 +00001046 DetectionPostProcessLayer,
Derek Lamberti87acb272019-03-27 16:51:31 +00001047 LstmLayer,
Jan Eilers5b01a892019-07-23 09:47:43 +01001048 QuantizedLstmLayer,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +00001049 QuantizeLayer,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +01001050 DequantizeLayer,
Sadik Armaganeff363d2019-04-05 15:25:46 +01001051 MergeLayer,
Jim Flynne242f2d2019-05-22 14:24:13 +01001052 SwitchLayer,
Aron Virginas-Taraa067142019-06-11 16:01:44 +01001053 ConcatLayer,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +01001054 SpaceToDepthLayer,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +01001055 PreluLayer,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +01001056 TransposeConvolution2dLayer,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +01001057 ResizeLayer,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +01001058 StackLayer,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +01001059 AbsLayer,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +01001060 ArgMinMaxLayer,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +01001061 SliceLayer,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +01001062 DepthToSpaceLayer,
Sadik Armagan26257852019-10-14 13:00:47 +01001063 InstanceNormalizationLayer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001064 LogSoftmaxLayer,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +01001065 ComparisonLayer,
josh minor4a3c6102020-01-06 16:40:46 -06001066 StandInLayer,
Mike Kellyc9ea45a2020-02-28 18:11:58 +00001067 ElementwiseUnaryLayer,
James Conroy8d333182020-05-13 10:27:58 +01001068 TransposeLayer,
Keith Davis300ad562020-06-04 16:34:23 +01001069 QLstmLayer,
Finn Williams2605b232020-06-10 15:53:46 +01001070 FillLayer,
James Conroyaba90cd2020-11-06 16:28:18 +00001071 RankLayer,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +00001072 LogicalBinaryLayer,
mathad01b392e982021-04-07 12:07:30 +01001073 ReduceLayer,
Keith Davis3ae3f972021-05-21 16:33:48 +01001074 CastLayer,
Narumol Prangnawarata0162e12021-07-23 14:47:49 +01001075 ShapeLayer,
1076 UnidirectionalSequenceLstmLayer,
Simon Obute51f67772021-09-03 15:50:13 +01001077 ChannelShuffleLayer,
Matthew Sloyanb63a3112021-09-08 13:05:51 +01001078 Convolution3dLayer,
Tamas Nyirid998a1c2021-11-05 14:55:33 +00001079 Pooling3dLayer,
Teresa Charlin6966bfa2022-04-25 17:14:50 +01001080 GatherNdLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001081}
1082
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001083table AnyLayer {
1084 layer:Layer;
1085}
1086
Tee Jungaa920c52019-11-05 10:48:25 +00001087table FeatureCompatibilityVersions {
1088 bindingIdsScheme:uint = 0;
Jan Eilers53ef7952021-06-02 12:01:25 +01001089 weightsLayoutScheme:uint = 0;
Matthew Sloyan81beae32021-07-13 19:46:11 +01001090 constantTensorsAsInputs:uint = 0;
Tee Jungaa920c52019-11-05 10:48:25 +00001091}
1092
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001093// Root type for serialized data is the graph of the network
1094table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001095 layers:[AnyLayer];
Tee Jungaa920c52019-11-05 10:48:25 +00001096 inputIds:[int];
1097 outputIds:[int];
1098 featureVersions:FeatureCompatibilityVersions;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001099}
1100
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +00001101root_type SerializedGraph;