blob: 2dbfd85b2352eaf218931d7ace7aa6df2ac78441 [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,
Samuel Yapb9e6b5c2022-08-19 11:14:38 +0100185 BatchMatMul = 68,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000186}
187
188// Base layer table to be used as part of other layers
189table LayerBase {
190 index:uint;
191 layerName:string;
192 layerType:LayerType;
193 inputSlots:[InputSlot];
194 outputSlots:[OutputSlot];
195}
196
197table BindableLayerBase {
198 base:LayerBase;
199 layerBindingId:int;
200}
201
202// Table for each layer defined below
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100203
josh minor4a3c6102020-01-06 16:40:46 -0600204/// @deprecated Use ElementwiseUnaryLayer instead
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100205table AbsLayer {
206 base:LayerBase;
207}
208
Mike Kellyaf484012019-02-20 16:53:11 +0000209table ActivationLayer {
210 base:LayerBase;
211 descriptor:ActivationDescriptor;
212}
213
214table ActivationDescriptor {
Tee Jung86bc3d82019-10-01 11:25:56 +0900215 activationFunction:ActivationFunction = Sigmoid;
Mike Kellyaf484012019-02-20 16:53:11 +0000216 a:float;
217 b:float;
218}
219
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000220table AdditionLayer {
221 base:LayerBase;
222}
223
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100224table ArgMinMaxLayer {
225 base:LayerBase;
226 descriptor:ArgMinMaxDescriptor;
227}
228
229table ArgMinMaxDescriptor{
Tee Jung86bc3d82019-10-01 11:25:56 +0900230 argMinMaxFunction:ArgMinMaxFunction;
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100231 axis:int;
232}
233
mathad01b392e982021-04-07 12:07:30 +0100234table CastLayer {
235 base:LayerBase;
236}
237
Simon Obute51f67772021-09-03 15:50:13 +0100238table ChannelShuffleLayer {
239 base:LayerBase;
240 descriptor:ChannelShuffleDescriptor;
241}
242
243table ChannelShuffleDescriptor {
244 axis:uint = 0;
245 numGroups:uint = 0;
246}
247
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100248enum ComparisonOperation : byte {
249 Equal = 0,
250 Greater = 1,
251 GreaterOrEqual = 2,
252 Less = 3,
253 LessOrEqual = 4,
254 NotEqual = 5
255}
256
257table ComparisonDescriptor {
258 operation:ComparisonOperation;
259}
260
261table ComparisonLayer {
262 base:LayerBase;
263 descriptor:ComparisonDescriptor;
264}
265
Conor Kennedy76277882019-02-26 08:29:54 +0000266table ConstantLayer {
267 base:LayerBase;
268 input:ConstTensor;
269}
270
Mike Kellya0766c32019-02-19 17:22:07 +0000271table Convolution2dLayer {
272 base:LayerBase;
273 descriptor:Convolution2dDescriptor;
274 weights:ConstTensor;
275 biases:ConstTensor;
276}
277
278table Convolution2dDescriptor {
279 padLeft:uint;
280 padRight:uint;
281 padTop:uint;
282 padBottom:uint;
283 strideX:uint;
284 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100285 dilationX:uint = 1;
286 dilationY:uint = 1;
Mike Kellya0766c32019-02-19 17:22:07 +0000287 biasEnabled:bool = false;
288 dataLayout:DataLayout = NCHW;
289}
290
Matthew Sloyanb63a3112021-09-08 13:05:51 +0100291table Convolution3dLayer {
292 base:LayerBase;
293 descriptor:Convolution3dDescriptor;
Matthew Sloyanb63a3112021-09-08 13:05:51 +0100294}
295
296table Convolution3dDescriptor {
297 padLeft:uint;
298 padRight:uint;
299 padTop:uint;
300 padBottom:uint;
301 padFront:uint;
302 padBack:uint;
303 strideX:uint;
304 strideY:uint;
305 strideZ:uint;
306 dilationX:uint = 1;
307 dilationY:uint = 1;
308 dilationZ:uint = 1;
309 biasEnabled:bool = false;
310 dataLayout:DataLayout = NDHWC;
311}
312
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100313table DepthToSpaceLayer {
314 base:LayerBase;
315 descriptor:DepthToSpaceDescriptor;
316}
317
318table DepthToSpaceDescriptor {
319 blockSize:uint;
320 dataLayout:DataLayout;
321}
322
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000323table DivisionLayer {
324 base:LayerBase;
325}
326
josh minor4a3c6102020-01-06 16:40:46 -0600327enum UnaryOperation : byte {
328 Abs = 0,
329 Rsqrt = 1,
330 Sqrt = 2,
331 Exp = 3,
James Conroyaba90cd2020-11-06 16:28:18 +0000332 Neg = 4,
Teresa Charlin50de4fa2021-05-31 18:47:33 +0100333 LogicalNot = 5,
334 Log = 6,
335 Sin = 7
josh minor4a3c6102020-01-06 16:40:46 -0600336}
337
338table ElementwiseUnaryDescriptor {
339 operation:UnaryOperation;
340}
341
342table ElementwiseUnaryLayer {
343 base:LayerBase;
344 descriptor:ElementwiseUnaryDescriptor;
345}
346
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100347/// @deprecated Use ComparisonLayer instead
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000348table EqualLayer {
349 base:LayerBase;
350}
351
Keith Davis300ad562020-06-04 16:34:23 +0100352table FillLayer {
353 base:LayerBase;
354 descriptor:FillDescriptor;
355}
356
357table FillDescriptor {
358 value:float;
359}
360
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000361table FloorLayer{
362 base:LayerBase;
363}
364
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000365table FullyConnectedLayer {
366 base:LayerBase;
367 descriptor:FullyConnectedDescriptor;
Matthew Sloyan81beae32021-07-13 19:46:11 +0100368 weights:ConstTensor; // ConstTensors are now passed as inputs.
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000369 biases:ConstTensor;
370}
371
372table FullyConnectedDescriptor {
373 biasEnabled:bool = false;
374 transposeWeightsMatrix:bool = false;
Sadik Armaganf0a6dec2021-03-25 07:46:55 +0000375 constantWeights:bool = true;
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000376}
377
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000378table GatherLayer {
379 base:LayerBase;
Teresa Charlin52664732020-06-29 16:27:03 +0100380 descriptor:GatherDescriptor;
381}
382
383table GatherDescriptor {
384 axis:int = 0;
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000385}
386
Teresa Charlin6966bfa2022-04-25 17:14:50 +0100387table GatherNdLayer {
388 base:LayerBase;
389}
390
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100391/// @deprecated Use ComparisonLayer instead
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000392table GreaterLayer {
393 base:LayerBase;
394}
395
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000396table InputLayer {
397 base:BindableLayerBase;
398}
399
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100400table InstanceNormalizationLayer {
401 base:LayerBase;
402 descriptor:InstanceNormalizationDescriptor;
403}
404
405table InstanceNormalizationDescriptor {
406 gamma:float;
407 beta:float;
408 eps:float;
409 dataLayout:DataLayout;
410}
411
Sadik Armagan26257852019-10-14 13:00:47 +0100412table LogSoftmaxLayer {
413 base:LayerBase;
414 descriptor:LogSoftmaxDescriptor;
415}
416
417table LogSoftmaxDescriptor {
418 beta:float = 1;
419 axis:int = -1;
420}
421
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000422table L2NormalizationLayer {
423 base:LayerBase;
424 descriptor:L2NormalizationDescriptor;
425}
426
427table L2NormalizationDescriptor {
428 dataLayout:DataLayout = NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100429 eps:float = 1e-12;
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000430}
431
James Conroyaba90cd2020-11-06 16:28:18 +0000432enum LogicalBinaryOperation : byte {
433 LogicalAnd = 0,
434 LogicalOr = 1
435}
436
437table LogicalBinaryDescriptor {
438 operation:LogicalBinaryOperation;
439}
440
441table LogicalBinaryLayer {
442 base:LayerBase;
443 descriptor:LogicalBinaryDescriptor;
444}
445
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000446table MinimumLayer {
447 base:LayerBase;
448}
449
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000450table MaximumLayer {
451 base:LayerBase;
452}
453
Sadik Armagan5f450272019-02-12 14:31:45 +0000454table MultiplicationLayer {
455 base:LayerBase;
456}
457
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000458table Pooling2dLayer {
459 base:LayerBase;
460 descriptor:Pooling2dDescriptor;
461}
462
Tamas Nyirid998a1c2021-11-05 14:55:33 +0000463table Pooling3dLayer {
464 base:LayerBase;
465 descriptor:Pooling3dDescriptor;
466}
467
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000468enum PoolingAlgorithm : byte {
469 Max = 0,
470 Average = 1,
471 L2 = 2
472}
473
474enum OutputShapeRounding : byte {
475 Floor = 0,
476 Ceiling = 1
477}
478
479enum PaddingMethod : byte {
480 IgnoreValue = 0,
481 Exclude = 1
482}
483
484table Pooling2dDescriptor {
485 poolType:PoolingAlgorithm;
486 padLeft:uint;
487 padRight:uint;
488 padTop:uint;
489 padBottom:uint;
490 poolWidth:uint;
491 poolHeight:uint;
492 strideX:uint;
493 strideY:uint;
494 outputShapeRounding:OutputShapeRounding;
495 paddingMethod:PaddingMethod;
496 dataLayout:DataLayout;
497}
498
Tamas Nyirid998a1c2021-11-05 14:55:33 +0000499table Pooling3dDescriptor {
500 poolType:PoolingAlgorithm;
501 padLeft:uint;
502 padRight:uint;
503 padTop:uint;
504 padBottom:uint;
505 padFront:uint;
506 padBack:uint;
507 poolWidth:uint;
508 poolHeight:uint;
509 poolDepth:uint;
510 strideX:uint;
511 strideY:uint;
512 strideZ:uint;
513 outputShapeRounding:OutputShapeRounding;
514 paddingMethod:PaddingMethod;
515 dataLayout:DataLayout;
516}
517
Derek Lamberti87acb272019-03-27 16:51:31 +0000518table QuantizeLayer {
519 base:LayerBase;
520}
521
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000522table SoftmaxLayer {
523 base:LayerBase;
524 descriptor:SoftmaxDescriptor;
525}
526
527table SoftmaxDescriptor {
528 beta:float;
Sadik Armaganfd0cae32021-11-08 17:18:31 +0000529 axis:int = -1;
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000530}
531
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000532table DepthwiseConvolution2dLayer {
533 base:LayerBase;
534 descriptor:DepthwiseConvolution2dDescriptor;
535 weights:ConstTensor;
536 biases:ConstTensor;
537}
538
539table DepthwiseConvolution2dDescriptor {
540 padLeft:uint;
541 padRight:uint;
542 padTop:uint;
543 padBottom:uint;
544 strideX:uint;
545 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100546 dilationX:uint = 1;
547 dilationY:uint = 1;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000548 biasEnabled:bool = false;
549 dataLayout:DataLayout = NCHW;
550}
551
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000552table OutputLayer {
553 base:BindableLayerBase;
554}
555
Saoirse Stewart263829c2019-02-19 15:54:14 +0000556table ReshapeLayer {
557 base:LayerBase;
558 descriptor:ReshapeDescriptor;
559}
560
561table ReshapeDescriptor {
Keith Davis3ae3f972021-05-21 16:33:48 +0100562 targetShape:[uint];
Saoirse Stewart263829c2019-02-19 15:54:14 +0000563}
564
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000565table PermuteLayer {
566 base:LayerBase;
567 descriptor:PermuteDescriptor;
568}
569
570table PermuteDescriptor {
571 dimMappings:[uint];
572}
573
Keith Davis3ae3f972021-05-21 16:33:48 +0100574table ShapeLayer {
575 base:LayerBase;
576}
577
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000578table SpaceToBatchNdLayer {
579 base:LayerBase;
580 descriptor:SpaceToBatchNdDescriptor;
581}
582
583table SpaceToBatchNdDescriptor {
584 blockShape:[uint];
585 padList:[uint];
586 dataLayout:DataLayout;
587}
588
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100589table SpaceToDepthLayer {
590 base:LayerBase;
591 descriptor:SpaceToDepthDescriptor;
592}
593
594table SpaceToDepthDescriptor {
595 blockSize:uint;
596 dataLayout:DataLayout;
597}
598
Conor Kennedyda1f9752019-03-01 14:37:12 +0000599table SubtractionLayer {
600 base:LayerBase;
601}
602
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000603table BatchToSpaceNdLayer {
604 base:LayerBase;
605 descriptor:BatchToSpaceNdDescriptor;
606}
607
608table BatchToSpaceNdDescriptor {
609 blockShape:[uint];
610 crops:[uint];
611 dataLayout:DataLayout;
612}
613
Nina Drozd57728782019-02-27 10:53:27 +0000614enum NormalizationAlgorithmChannel : byte {
615 Across = 0,
616 Within = 1
617}
618
619enum NormalizationAlgorithmMethod : byte {
620 LocalBrightness = 0,
621 LocalContrast = 1
622}
623
624table NormalizationLayer {
625 base:LayerBase;
626 descriptor:NormalizationDescriptor;
627}
628
629table NormalizationDescriptor {
630 normChannelType:NormalizationAlgorithmChannel = Across;
631 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
632 normSize:uint;
633 alpha:float;
634 beta:float;
635 k:float;
636 dataLayout:DataLayout = NCHW;
637}
638
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000639table MeanLayer {
640 base:LayerBase;
641 descriptor:MeanDescriptor;
642}
643
644table MeanDescriptor {
645 axis:[uint];
646 keepDims:bool = false;
647}
648
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000649table PadLayer {
650 base:LayerBase;
651 descriptor:PadDescriptor;
652}
653
Matthew Sloyan2e5d0b22021-10-21 14:05:31 +0100654enum PaddingMode : byte {
655 Constant = 0,
656 Reflect = 1,
657 Symmetric = 2
658}
659
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000660table PadDescriptor {
661 padList:[uint];
David Monahan34757812019-06-19 11:47:21 +0100662 padValue:float = 0;
Matthew Sloyan2e5d0b22021-10-21 14:05:31 +0100663 paddingMode:PaddingMode = Constant;
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000664}
665
josh minor4a3c6102020-01-06 16:40:46 -0600666/// @deprecated Use ElementwiseUnaryLayer instead
Sadik Armagan8b42a382019-03-01 14:24:49 +0000667table RsqrtLayer {
668 base:LayerBase;
669}
670
ruoyan018e7fa232019-02-28 15:09:07 +0000671table BatchNormalizationLayer {
672 base:LayerBase;
673 descriptor:BatchNormalizationDescriptor;
674 mean:ConstTensor;
675 variance:ConstTensor;
676 beta:ConstTensor;
677 gamma:ConstTensor;
678}
679
680table BatchNormalizationDescriptor {
681 eps:float;
682 dataLayout:DataLayout;
683}
684
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100685/// @deprecated Use ResizeLayer instead
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000686table ResizeBilinearLayer {
687 base:LayerBase;
688 descriptor:ResizeBilinearDescriptor;
689}
690
691table ResizeBilinearDescriptor {
692 targetWidth:uint;
693 targetHeight:uint;
694 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100695 alignCorners:bool;
696 halfPixelCenters:bool;
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000697}
698
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100699table SliceLayer {
700 base:LayerBase;
701 descriptor:SliceDescriptor;
702}
703
704table SliceDescriptor {
705 begin:[uint];
706 size:[uint];
707}
708
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000709table StridedSliceLayer {
710 base:LayerBase;
711 descriptor:StridedSliceDescriptor;
712}
713
714table StridedSliceDescriptor {
715 begin:[int];
716 end:[int];
717 stride:[int];
718 beginMask:int;
719 endMask:int;
720 shrinkAxisMask:int;
721 ellipsisMask:int;
722 newAxisMask:int;
723 dataLayout:DataLayout;
724}
725
Jim Flynne242f2d2019-05-22 14:24:13 +0100726table ConcatLayer {
727 base:LayerBase;
728 descriptor:OriginsDescriptor;
729}
730
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100731/// @deprecated Use ConcatLayer instead
Jim Flynnac25a1b2019-02-28 10:40:49 +0000732table MergerLayer {
733 base:LayerBase;
734 descriptor:OriginsDescriptor;
735}
736
737table UintVector {
738 data:[uint];
739}
740
741table OriginsDescriptor {
742 concatAxis:uint;
743 numViews:uint;
744 numDimensions:uint;
745 viewOrigins:[UintVector];
746}
747
Jim Flynn18ce3382019-03-08 11:08:30 +0000748table ViewsDescriptor {
749 origins:OriginsDescriptor;
750 viewSizes:[UintVector];
751}
752
753table SplitterLayer {
754 base:LayerBase;
755 descriptor:ViewsDescriptor;
756}
757
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000758table DetectionPostProcessLayer {
759 base:LayerBase;
760 descriptor:DetectionPostProcessDescriptor;
761 anchors:ConstTensor;
762}
763
764table DetectionPostProcessDescriptor {
765 maxDetections:uint;
766 maxClassesPerDetection:uint;
767 detectionsPerClass:uint;
768 nmsScoreThreshold:float;
769 nmsIouThreshold:float;
770 numClasses:uint;
771 useRegularNms:bool;
772 scaleX:float;
773 scaleY:float;
774 scaleW:float;
775 scaleH:float;
776}
777
Jim Flynn11af3752019-03-19 17:22:29 +0000778table LstmInputParams {
779 inputToForgetWeights:ConstTensor;
780 inputToCellWeights:ConstTensor;
781 inputToOutputWeights:ConstTensor;
782 recurrentToForgetWeights:ConstTensor;
783 recurrentToCellWeights:ConstTensor;
784 recurrentToOutputWeights:ConstTensor;
785 forgetGateBias:ConstTensor;
786 cellBias:ConstTensor;
787 outputGateBias:ConstTensor;
788
789 inputToInputWeights:ConstTensor;
790 recurrentToInputWeights:ConstTensor;
791 cellToInputWeights:ConstTensor;
792 inputGateBias:ConstTensor;
793
794 projectionWeights:ConstTensor;
795 projectionBias:ConstTensor;
796
797 cellToForgetWeights:ConstTensor;
798 cellToOutputWeights:ConstTensor;
Jan Eilersf8c62972019-07-17 11:07:49 +0100799
800 inputLayerNormWeights:ConstTensor;
801 forgetLayerNormWeights:ConstTensor;
802 cellLayerNormWeights:ConstTensor;
803 outputLayerNormWeights:ConstTensor;
Jim Flynn11af3752019-03-19 17:22:29 +0000804}
805
James Conroy8d333182020-05-13 10:27:58 +0100806table LstmDescriptor {
807 activationFunc:uint;
808 clippingThresCell:float;
809 clippingThresProj:float;
810 cifgEnabled:bool = true;
811 peepholeEnabled:bool = false;
812 projectionEnabled:bool = false;
813 layerNormEnabled:bool = false;
814}
815
816table LstmLayer {
817 base:LayerBase;
818 descriptor:LstmDescriptor;
819 inputParams:LstmInputParams;
820}
821
822table QLstmInputParams {
823 // Mandatory
824 inputToForgetWeights:ConstTensor;
825 inputToCellWeights:ConstTensor;
826 inputToOutputWeights:ConstTensor;
827
828 recurrentToForgetWeights:ConstTensor;
829 recurrentToCellWeights:ConstTensor;
830 recurrentToOutputWeights:ConstTensor;
831
832 forgetGateBias:ConstTensor;
833 cellBias:ConstTensor;
834 outputGateBias:ConstTensor;
835
836 // CIFG
837 inputToInputWeights:ConstTensor;
838 recurrentToInputWeights:ConstTensor;
839 inputGateBias:ConstTensor;
840
841 // Projection
842 projectionWeights:ConstTensor;
843 projectionBias:ConstTensor;
844
845 // Peephole
846 cellToInputWeights:ConstTensor;
847 cellToForgetWeights:ConstTensor;
848 cellToOutputWeights:ConstTensor;
849
850 // Layer norm
851 inputLayerNormWeights:ConstTensor;
852 forgetLayerNormWeights:ConstTensor;
853 cellLayerNormWeights:ConstTensor;
854 outputLayerNormWeights:ConstTensor;
855}
856
857table QLstmDescriptor {
858 cifgEnabled:bool = true;
859 peepholeEnabled:bool = false;
860 projectionEnabled:bool = false;
861 layerNormEnabled:bool = false;
862
863 cellClip:float;
864 projectionClip:float;
865
866 inputIntermediateScale:float;
867 forgetIntermediateScale:float;
868 cellIntermediateScale:float;
869 outputIntermediateScale:float;
870
871 hiddenStateZeroPoint:int;
872 hiddenStateScale:float;
873}
874
875table QLstmLayer {
876 base:LayerBase;
877 descriptor:QLstmDescriptor;
878 inputParams:QLstmInputParams;
879}
880
Jan Eilers5b01a892019-07-23 09:47:43 +0100881table QuantizedLstmInputParams {
882 inputToInputWeights:ConstTensor;
883 inputToForgetWeights:ConstTensor;
884 inputToCellWeights:ConstTensor;
885 inputToOutputWeights:ConstTensor;
886
887 recurrentToInputWeights:ConstTensor;
888 recurrentToForgetWeights:ConstTensor;
889 recurrentToCellWeights:ConstTensor;
890 recurrentToOutputWeights:ConstTensor;
891
892 inputGateBias:ConstTensor;
893 forgetGateBias:ConstTensor;
894 cellBias:ConstTensor;
895 outputGateBias:ConstTensor;
896}
897
Jan Eilers5b01a892019-07-23 09:47:43 +0100898table QuantizedLstmLayer {
899 base:LayerBase;
900 inputParams:QuantizedLstmInputParams;
901}
902
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000903table DequantizeLayer {
904 base:LayerBase;
905}
906
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100907table MergeLayer {
908 base:LayerBase;
909}
910
Sadik Armaganeff363d2019-04-05 15:25:46 +0100911table SwitchLayer {
912 base:LayerBase;
913}
914
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100915table PreluLayer {
916 base:LayerBase;
917}
918
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100919table TransposeConvolution2dLayer {
920 base:LayerBase;
921 descriptor:TransposeConvolution2dDescriptor;
922 weights:ConstTensor;
923 biases:ConstTensor;
924}
925
926table TransposeConvolution2dDescriptor {
927 padLeft:uint;
928 padRight:uint;
929 padTop:uint;
930 padBottom:uint;
931 strideX:uint;
932 strideY:uint;
933 biasEnabled:bool = false;
934 dataLayout:DataLayout = NCHW;
935}
936
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000937table TransposeLayer {
938 base:LayerBase;
939 descriptor:TransposeDescriptor;
940}
941
942table TransposeDescriptor {
943 dimMappings:[uint];
944}
945
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100946table ResizeLayer {
947 base:LayerBase;
948 descriptor:ResizeDescriptor;
949}
950
951table ResizeDescriptor {
952 targetHeight:uint;
953 targetWidth:uint;
954 method:ResizeMethod = NearestNeighbor;
955 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100956 alignCorners:bool;
957 halfPixelCenters:bool;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100958}
959
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100960table StackLayer {
961 base:LayerBase;
962 descriptor:StackDescriptor;
963}
964
965table StackDescriptor {
966 axis:uint;
967 numInputs:uint;
968 inputShape:[uint];
969}
970
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100971table StandInDescriptor {
972 numInputs:uint;
973 numOutputs:uint;
974}
975
976table StandInLayer {
977 base:LayerBase;
978 descriptor:StandInDescriptor;
979}
980
Finn Williams2605b232020-06-10 15:53:46 +0100981table RankLayer {
982 base:LayerBase;
983}
984
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000985table ReduceLayer {
986 base:LayerBase;
987 descriptor:ReduceDescriptor;
988}
989
990table ReduceDescriptor {
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000991 keepDims:bool = false;
992 axis:[uint];
993 reduceOperation:ReduceOperation = Sum;
994}
995
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100996table UnidirectionalSequenceLstmDescriptor {
997 activationFunc:uint;
998 clippingThresCell:float;
999 clippingThresProj:float;
1000 cifgEnabled:bool = true;
1001 peepholeEnabled:bool = false;
1002 projectionEnabled:bool = false;
1003 layerNormEnabled:bool = false;
1004 timeMajor:bool = false;
1005}
1006
1007table UnidirectionalSequenceLstmLayer {
1008 base:LayerBase;
1009 descriptor:UnidirectionalSequenceLstmDescriptor;
1010 inputParams:LstmInputParams;
1011}
1012
Samuel Yapb9e6b5c2022-08-19 11:14:38 +01001013table BatchMatMulDescriptor {
1014 transposeX:bool = false;
1015 transposeY:bool = false;
1016 adjointX:bool = false;
1017 adjointY:bool = false;
1018 dataLayoutX:DataLayout = NCHW;
1019 dataLayoutY:DataLayout = NCHW;
1020}
1021
1022table BatchMatMulLayer {
1023 base:LayerBase;
1024 descriptor:BatchMatMulDescriptor;
1025}
1026
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001027union Layer {
Mike Kellyaf484012019-02-20 16:53:11 +00001028 ActivationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001029 AdditionLayer,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +00001030 BatchToSpaceNdLayer,
ruoyan018e7fa232019-02-28 15:09:07 +00001031 BatchNormalizationLayer,
Conor Kennedy76277882019-02-26 08:29:54 +00001032 ConstantLayer,
Mike Kellya0766c32019-02-19 17:22:07 +00001033 Convolution2dLayer,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +00001034 DepthwiseConvolution2dLayer,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +00001035 FullyConnectedLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001036 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +00001037 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +00001038 OutputLayer,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +00001039 PermuteLayer,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +00001040 Pooling2dLayer,
Saoirse Stewart263829c2019-02-19 15:54:14 +00001041 ReshapeLayer,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +00001042 SoftmaxLayer,
Éanna Ó Catháin58885892019-02-27 16:16:39 +00001043 SpaceToBatchNdLayer,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +00001044 DivisionLayer,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +00001045 MinimumLayer,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +00001046 EqualLayer,
Nina Drozd57728782019-02-27 10:53:27 +00001047 MaximumLayer,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +00001048 NormalizationLayer,
Sadik Armagan8b42a382019-03-01 14:24:49 +00001049 PadLayer,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +00001050 RsqrtLayer,
Conor Kennedy79ffdf52019-03-01 14:24:54 +00001051 FloorLayer,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +00001052 GreaterLayer,
Conor Kennedyda1f9752019-03-01 14:37:12 +00001053 ResizeBilinearLayer,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +00001054 SubtractionLayer,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +00001055 StridedSliceLayer,
Sadik Armaganac97c8c2019-03-04 17:44:21 +00001056 GatherLayer,
Jim Flynnac25a1b2019-02-28 10:40:49 +00001057 MeanLayer,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +00001058 MergerLayer,
Jim Flynn18ce3382019-03-08 11:08:30 +00001059 L2NormalizationLayer,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +00001060 SplitterLayer,
Jim Flynn11af3752019-03-19 17:22:29 +00001061 DetectionPostProcessLayer,
Derek Lamberti87acb272019-03-27 16:51:31 +00001062 LstmLayer,
Jan Eilers5b01a892019-07-23 09:47:43 +01001063 QuantizedLstmLayer,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +00001064 QuantizeLayer,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +01001065 DequantizeLayer,
Sadik Armaganeff363d2019-04-05 15:25:46 +01001066 MergeLayer,
Jim Flynne242f2d2019-05-22 14:24:13 +01001067 SwitchLayer,
Aron Virginas-Taraa067142019-06-11 16:01:44 +01001068 ConcatLayer,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +01001069 SpaceToDepthLayer,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +01001070 PreluLayer,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +01001071 TransposeConvolution2dLayer,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +01001072 ResizeLayer,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +01001073 StackLayer,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +01001074 AbsLayer,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +01001075 ArgMinMaxLayer,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +01001076 SliceLayer,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +01001077 DepthToSpaceLayer,
Sadik Armagan26257852019-10-14 13:00:47 +01001078 InstanceNormalizationLayer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +01001079 LogSoftmaxLayer,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +01001080 ComparisonLayer,
josh minor4a3c6102020-01-06 16:40:46 -06001081 StandInLayer,
Mike Kellyc9ea45a2020-02-28 18:11:58 +00001082 ElementwiseUnaryLayer,
James Conroy8d333182020-05-13 10:27:58 +01001083 TransposeLayer,
Keith Davis300ad562020-06-04 16:34:23 +01001084 QLstmLayer,
Finn Williams2605b232020-06-10 15:53:46 +01001085 FillLayer,
James Conroyaba90cd2020-11-06 16:28:18 +00001086 RankLayer,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +00001087 LogicalBinaryLayer,
mathad01b392e982021-04-07 12:07:30 +01001088 ReduceLayer,
Keith Davis3ae3f972021-05-21 16:33:48 +01001089 CastLayer,
Narumol Prangnawarata0162e12021-07-23 14:47:49 +01001090 ShapeLayer,
1091 UnidirectionalSequenceLstmLayer,
Simon Obute51f67772021-09-03 15:50:13 +01001092 ChannelShuffleLayer,
Matthew Sloyanb63a3112021-09-08 13:05:51 +01001093 Convolution3dLayer,
Tamas Nyirid998a1c2021-11-05 14:55:33 +00001094 Pooling3dLayer,
Teresa Charlin6966bfa2022-04-25 17:14:50 +01001095 GatherNdLayer,
Samuel Yapb9e6b5c2022-08-19 11:14:38 +01001096 BatchMatMulLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001097}
1098
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001099table AnyLayer {
1100 layer:Layer;
1101}
1102
Tee Jungaa920c52019-11-05 10:48:25 +00001103table FeatureCompatibilityVersions {
1104 bindingIdsScheme:uint = 0;
Jan Eilers53ef7952021-06-02 12:01:25 +01001105 weightsLayoutScheme:uint = 0;
Matthew Sloyan81beae32021-07-13 19:46:11 +01001106 constantTensorsAsInputs:uint = 0;
Tee Jungaa920c52019-11-05 10:48:25 +00001107}
1108
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001109// Root type for serialized data is the graph of the network
1110table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001111 layers:[AnyLayer];
Tee Jungaa920c52019-11-05 10:48:25 +00001112 inputIds:[int];
1113 outputIds:[int];
1114 featureVersions:FeatureCompatibilityVersions;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001115}
1116
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +00001117root_type SerializedGraph;