blob: a544161c5329669588cdb738483bd61cd45f8648 [file] [log] [blame]
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001//
Teresa Charlin52664732020-06-29 16:27:03 +01002// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00003// SPDX-License-Identifier: MIT
4//
5
Derek Lamberti0028d1b2019-02-20 13:57:42 +00006namespace armnnSerializer;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00007
8file_identifier "ARMN";
9
10file_extension "armnn";
11
Mike Kellyaf484012019-02-20 16:53:11 +000012enum ActivationFunction : byte {
13 Sigmoid = 0,
14 TanH = 1,
15 Linear = 2,
16 ReLu = 3,
17 BoundedReLu = 4,
18 SoftReLu = 5,
19 LeakyReLu = 6,
20 Abs = 7,
21 Sqrt = 8,
David Monahan3b3c3812020-02-25 09:03:29 +000022 Square = 9,
Colm Donelan03fbeaf2020-02-26 15:39:23 +000023 Elu = 10,
24 HardSwish = 11
Mike Kellyaf484012019-02-20 16:53:11 +000025}
26
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +010027enum ArgMinMaxFunction : byte {
28 Min = 0,
29 Max = 1
30}
31
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000032enum DataType : byte {
33 Float16 = 0,
34 Float32 = 1,
Derek Lambertif90c56d2020-01-10 17:14:08 +000035 QuantisedAsymm8 = 2, // deprecated
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000036 Signed32 = 3,
Nattapat Chaimanowongcd5ac232019-03-19 12:26:36 +000037 Boolean = 4,
Derek Lambertif90c56d2020-01-10 17:14:08 +000038 QuantisedSymm16 = 5, // deprecated
39 QAsymmU8 = 6,
Francis Murtaghddb1d062020-03-10 13:51:45 +000040 QSymmS16 = 7,
Sadik Armagan1a84fe32020-03-27 15:56:57 +000041 QAsymmS8 = 8,
Mike Kelly1f140f72021-04-06 12:25:55 +010042 QSymmS8 = 9,
43 Signed64 = 10
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000044}
45
Saoirse Stewart3166c3e2019-02-18 15:24:53 +000046enum DataLayout : byte {
47 NHWC = 0,
48 NCHW = 1
49}
50
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +000051enum ReduceOperation: byte {
52 Sum = 0,
53 Max = 1,
54 Mean = 2,
55 Min = 3
56}
57
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +010058enum ResizeMethod: byte {
59 NearestNeighbor = 0,
60 Bilinear = 1,
61}
62
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000063table TensorInfo {
64 dimensions:[uint];
65 dataType:DataType;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000066 quantizationScale:float = 1.0; // @deprecated Use quantizationScales instead
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000067 quantizationOffset:int = 0;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000068 quantizationScales:[float];
69 quantizationDim:uint;
Finn Williams2605b232020-06-10 15:53:46 +010070 dimensionality:uint = 1;
Colm Donelan800b2812021-02-12 12:43:35 +000071 dimensionSpecificity:[bool];
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000072}
73
74struct Connection {
75 sourceLayerIndex:uint;
76 outputSlotIndex:uint;
77}
78
79table ByteData {
80 data:[byte];
81}
82
83table ShortData {
84 data:[short];
85}
86
87table IntData {
88 data:[int];
89}
90
91table LongData {
92 data:[long];
93}
94
95union ConstTensorData { ByteData, ShortData, IntData, LongData }
96
97table ConstTensor {
98 info:TensorInfo;
99 data:ConstTensorData;
100}
101
102table InputSlot {
103 index:uint;
104 connection:Connection;
105}
106
107table OutputSlot {
108 index:uint;
109 tensorInfo:TensorInfo;
110}
111
112enum LayerType : uint {
113 Addition = 0,
114 Input = 1,
Sadik Armagan5f450272019-02-12 14:31:45 +0000115 Multiplication = 2,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000116 Output = 3,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000117 Pooling2d = 4,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000118 Reshape = 5,
Mike Kellya0766c32019-02-19 17:22:07 +0000119 Softmax = 6,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000120 Convolution2d = 7,
Mike Kellyaf484012019-02-20 16:53:11 +0000121 DepthwiseConvolution2d = 8,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000122 Activation = 9,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000123 Permute = 10,
Conor Kennedy76277882019-02-26 08:29:54 +0000124 FullyConnected = 11,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000125 Constant = 12,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000126 SpaceToBatchNd = 13,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000127 BatchToSpaceNd = 14,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000128 Division = 15,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000129 Minimum = 16,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000130 Equal = 17,
Nina Drozd57728782019-02-27 10:53:27 +0000131 Maximum = 18,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000132 Normalization = 19,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000133 Pad = 20,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000134 Rsqrt = 21,
ruoyan018e7fa232019-02-28 15:09:07 +0000135 Floor = 22,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000136 BatchNormalization = 23,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000137 Greater = 24,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000138 ResizeBilinear = 25,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000139 Subtraction = 26,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000140 StridedSlice = 27,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000141 Gather = 28,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000142 Mean = 29,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000143 Merger = 30,
Jim Flynn18ce3382019-03-08 11:08:30 +0000144 L2Normalization = 31,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000145 Splitter = 32,
Jim Flynn11af3752019-03-19 17:22:29 +0000146 DetectionPostProcess = 33,
Derek Lamberti87acb272019-03-27 16:51:31 +0000147 Lstm = 34,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000148 Quantize = 35,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100149 Dequantize = 36,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100150 Merge = 37,
Jim Flynne242f2d2019-05-22 14:24:13 +0100151 Switch = 38,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100152 Concat = 39,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100153 SpaceToDepth = 40,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100154 Prelu = 41,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100155 TransposeConvolution2d = 42,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100156 Resize = 43,
Jan Eilers5b01a892019-07-23 09:47:43 +0100157 Stack = 44,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100158 QuantizedLstm = 45,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100159 Abs = 46,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100160 ArgMinMax = 47,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100161 Slice = 48,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100162 DepthToSpace = 49,
Sadik Armagan26257852019-10-14 13:00:47 +0100163 InstanceNormalization = 50,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100164 LogSoftmax = 51,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100165 Comparison = 52,
josh minor4a3c6102020-01-06 16:40:46 -0600166 StandIn = 53,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000167 ElementwiseUnary = 54,
James Conroy8d333182020-05-13 10:27:58 +0100168 Transpose = 55,
Keith Davis300ad562020-06-04 16:34:23 +0100169 QLstm = 56,
Finn Williams2605b232020-06-10 15:53:46 +0100170 Fill = 57,
James Conroyaba90cd2020-11-06 16:28:18 +0000171 Rank = 58,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000172 LogicalBinary = 59,
mathad01b392e982021-04-07 12:07:30 +0100173 Reduce = 60,
Keith Davis3ae3f972021-05-21 16:33:48 +0100174 Cast = 61,
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100175 Shape = 62,
176 UnidirectionalSequenceLstm = 63,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000177}
178
179// Base layer table to be used as part of other layers
180table LayerBase {
181 index:uint;
182 layerName:string;
183 layerType:LayerType;
184 inputSlots:[InputSlot];
185 outputSlots:[OutputSlot];
186}
187
188table BindableLayerBase {
189 base:LayerBase;
190 layerBindingId:int;
191}
192
193// Table for each layer defined below
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100194
josh minor4a3c6102020-01-06 16:40:46 -0600195/// @deprecated Use ElementwiseUnaryLayer instead
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100196table AbsLayer {
197 base:LayerBase;
198}
199
Mike Kellyaf484012019-02-20 16:53:11 +0000200table ActivationLayer {
201 base:LayerBase;
202 descriptor:ActivationDescriptor;
203}
204
205table ActivationDescriptor {
Tee Jung86bc3d82019-10-01 11:25:56 +0900206 activationFunction:ActivationFunction = Sigmoid;
Mike Kellyaf484012019-02-20 16:53:11 +0000207 a:float;
208 b:float;
209}
210
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000211table AdditionLayer {
212 base:LayerBase;
213}
214
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100215table ArgMinMaxLayer {
216 base:LayerBase;
217 descriptor:ArgMinMaxDescriptor;
218}
219
220table ArgMinMaxDescriptor{
Tee Jung86bc3d82019-10-01 11:25:56 +0900221 argMinMaxFunction:ArgMinMaxFunction;
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100222 axis:int;
223}
224
mathad01b392e982021-04-07 12:07:30 +0100225table CastLayer {
226 base:LayerBase;
227}
228
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100229enum ComparisonOperation : byte {
230 Equal = 0,
231 Greater = 1,
232 GreaterOrEqual = 2,
233 Less = 3,
234 LessOrEqual = 4,
235 NotEqual = 5
236}
237
238table ComparisonDescriptor {
239 operation:ComparisonOperation;
240}
241
242table ComparisonLayer {
243 base:LayerBase;
244 descriptor:ComparisonDescriptor;
245}
246
Conor Kennedy76277882019-02-26 08:29:54 +0000247table ConstantLayer {
248 base:LayerBase;
249 input:ConstTensor;
250}
251
Mike Kellya0766c32019-02-19 17:22:07 +0000252table Convolution2dLayer {
253 base:LayerBase;
254 descriptor:Convolution2dDescriptor;
255 weights:ConstTensor;
256 biases:ConstTensor;
257}
258
259table Convolution2dDescriptor {
260 padLeft:uint;
261 padRight:uint;
262 padTop:uint;
263 padBottom:uint;
264 strideX:uint;
265 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100266 dilationX:uint = 1;
267 dilationY:uint = 1;
Mike Kellya0766c32019-02-19 17:22:07 +0000268 biasEnabled:bool = false;
269 dataLayout:DataLayout = NCHW;
270}
271
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100272table DepthToSpaceLayer {
273 base:LayerBase;
274 descriptor:DepthToSpaceDescriptor;
275}
276
277table DepthToSpaceDescriptor {
278 blockSize:uint;
279 dataLayout:DataLayout;
280}
281
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000282table DivisionLayer {
283 base:LayerBase;
284}
285
josh minor4a3c6102020-01-06 16:40:46 -0600286enum UnaryOperation : byte {
287 Abs = 0,
288 Rsqrt = 1,
289 Sqrt = 2,
290 Exp = 3,
James Conroyaba90cd2020-11-06 16:28:18 +0000291 Neg = 4,
Teresa Charlin50de4fa2021-05-31 18:47:33 +0100292 LogicalNot = 5,
293 Log = 6,
294 Sin = 7
josh minor4a3c6102020-01-06 16:40:46 -0600295}
296
297table ElementwiseUnaryDescriptor {
298 operation:UnaryOperation;
299}
300
301table ElementwiseUnaryLayer {
302 base:LayerBase;
303 descriptor:ElementwiseUnaryDescriptor;
304}
305
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100306/// @deprecated Use ComparisonLayer instead
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000307table EqualLayer {
308 base:LayerBase;
309}
310
Keith Davis300ad562020-06-04 16:34:23 +0100311table FillLayer {
312 base:LayerBase;
313 descriptor:FillDescriptor;
314}
315
316table FillDescriptor {
317 value:float;
318}
319
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000320table FloorLayer{
321 base:LayerBase;
322}
323
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000324table FullyConnectedLayer {
325 base:LayerBase;
326 descriptor:FullyConnectedDescriptor;
327 weights:ConstTensor;
328 biases:ConstTensor;
329}
330
331table FullyConnectedDescriptor {
332 biasEnabled:bool = false;
333 transposeWeightsMatrix:bool = false;
Sadik Armaganf0a6dec2021-03-25 07:46:55 +0000334 constantWeights:bool = true;
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000335}
336
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000337table GatherLayer {
338 base:LayerBase;
Teresa Charlin52664732020-06-29 16:27:03 +0100339 descriptor:GatherDescriptor;
340}
341
342table GatherDescriptor {
343 axis:int = 0;
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000344}
345
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100346/// @deprecated Use ComparisonLayer instead
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000347table GreaterLayer {
348 base:LayerBase;
349}
350
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000351table InputLayer {
352 base:BindableLayerBase;
353}
354
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100355table InstanceNormalizationLayer {
356 base:LayerBase;
357 descriptor:InstanceNormalizationDescriptor;
358}
359
360table InstanceNormalizationDescriptor {
361 gamma:float;
362 beta:float;
363 eps:float;
364 dataLayout:DataLayout;
365}
366
Sadik Armagan26257852019-10-14 13:00:47 +0100367table LogSoftmaxLayer {
368 base:LayerBase;
369 descriptor:LogSoftmaxDescriptor;
370}
371
372table LogSoftmaxDescriptor {
373 beta:float = 1;
374 axis:int = -1;
375}
376
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000377table L2NormalizationLayer {
378 base:LayerBase;
379 descriptor:L2NormalizationDescriptor;
380}
381
382table L2NormalizationDescriptor {
383 dataLayout:DataLayout = NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100384 eps:float = 1e-12;
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000385}
386
James Conroyaba90cd2020-11-06 16:28:18 +0000387enum LogicalBinaryOperation : byte {
388 LogicalAnd = 0,
389 LogicalOr = 1
390}
391
392table LogicalBinaryDescriptor {
393 operation:LogicalBinaryOperation;
394}
395
396table LogicalBinaryLayer {
397 base:LayerBase;
398 descriptor:LogicalBinaryDescriptor;
399}
400
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000401table MinimumLayer {
402 base:LayerBase;
403}
404
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000405table MaximumLayer {
406 base:LayerBase;
407}
408
Sadik Armagan5f450272019-02-12 14:31:45 +0000409table MultiplicationLayer {
410 base:LayerBase;
411}
412
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000413table Pooling2dLayer {
414 base:LayerBase;
415 descriptor:Pooling2dDescriptor;
416}
417
418enum PoolingAlgorithm : byte {
419 Max = 0,
420 Average = 1,
421 L2 = 2
422}
423
424enum OutputShapeRounding : byte {
425 Floor = 0,
426 Ceiling = 1
427}
428
429enum PaddingMethod : byte {
430 IgnoreValue = 0,
431 Exclude = 1
432}
433
434table Pooling2dDescriptor {
435 poolType:PoolingAlgorithm;
436 padLeft:uint;
437 padRight:uint;
438 padTop:uint;
439 padBottom:uint;
440 poolWidth:uint;
441 poolHeight:uint;
442 strideX:uint;
443 strideY:uint;
444 outputShapeRounding:OutputShapeRounding;
445 paddingMethod:PaddingMethod;
446 dataLayout:DataLayout;
447}
448
Derek Lamberti87acb272019-03-27 16:51:31 +0000449table QuantizeLayer {
450 base:LayerBase;
451}
452
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000453table SoftmaxLayer {
454 base:LayerBase;
455 descriptor:SoftmaxDescriptor;
456}
457
458table SoftmaxDescriptor {
459 beta:float;
460}
461
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000462table DepthwiseConvolution2dLayer {
463 base:LayerBase;
464 descriptor:DepthwiseConvolution2dDescriptor;
465 weights:ConstTensor;
466 biases:ConstTensor;
467}
468
469table DepthwiseConvolution2dDescriptor {
470 padLeft:uint;
471 padRight:uint;
472 padTop:uint;
473 padBottom:uint;
474 strideX:uint;
475 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100476 dilationX:uint = 1;
477 dilationY:uint = 1;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000478 biasEnabled:bool = false;
479 dataLayout:DataLayout = NCHW;
480}
481
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000482table OutputLayer {
483 base:BindableLayerBase;
484}
485
Saoirse Stewart263829c2019-02-19 15:54:14 +0000486table ReshapeLayer {
487 base:LayerBase;
488 descriptor:ReshapeDescriptor;
489}
490
491table ReshapeDescriptor {
Keith Davis3ae3f972021-05-21 16:33:48 +0100492 targetShape:[uint];
Saoirse Stewart263829c2019-02-19 15:54:14 +0000493}
494
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000495table PermuteLayer {
496 base:LayerBase;
497 descriptor:PermuteDescriptor;
498}
499
500table PermuteDescriptor {
501 dimMappings:[uint];
502}
503
Keith Davis3ae3f972021-05-21 16:33:48 +0100504table ShapeLayer {
505 base:LayerBase;
506}
507
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000508table SpaceToBatchNdLayer {
509 base:LayerBase;
510 descriptor:SpaceToBatchNdDescriptor;
511}
512
513table SpaceToBatchNdDescriptor {
514 blockShape:[uint];
515 padList:[uint];
516 dataLayout:DataLayout;
517}
518
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100519table SpaceToDepthLayer {
520 base:LayerBase;
521 descriptor:SpaceToDepthDescriptor;
522}
523
524table SpaceToDepthDescriptor {
525 blockSize:uint;
526 dataLayout:DataLayout;
527}
528
Conor Kennedyda1f9752019-03-01 14:37:12 +0000529table SubtractionLayer {
530 base:LayerBase;
531}
532
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000533table BatchToSpaceNdLayer {
534 base:LayerBase;
535 descriptor:BatchToSpaceNdDescriptor;
536}
537
538table BatchToSpaceNdDescriptor {
539 blockShape:[uint];
540 crops:[uint];
541 dataLayout:DataLayout;
542}
543
Nina Drozd57728782019-02-27 10:53:27 +0000544enum NormalizationAlgorithmChannel : byte {
545 Across = 0,
546 Within = 1
547}
548
549enum NormalizationAlgorithmMethod : byte {
550 LocalBrightness = 0,
551 LocalContrast = 1
552}
553
554table NormalizationLayer {
555 base:LayerBase;
556 descriptor:NormalizationDescriptor;
557}
558
559table NormalizationDescriptor {
560 normChannelType:NormalizationAlgorithmChannel = Across;
561 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
562 normSize:uint;
563 alpha:float;
564 beta:float;
565 k:float;
566 dataLayout:DataLayout = NCHW;
567}
568
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000569table MeanLayer {
570 base:LayerBase;
571 descriptor:MeanDescriptor;
572}
573
574table MeanDescriptor {
575 axis:[uint];
576 keepDims:bool = false;
577}
578
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000579table PadLayer {
580 base:LayerBase;
581 descriptor:PadDescriptor;
582}
583
584table PadDescriptor {
585 padList:[uint];
David Monahan34757812019-06-19 11:47:21 +0100586 padValue:float = 0;
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000587}
588
josh minor4a3c6102020-01-06 16:40:46 -0600589/// @deprecated Use ElementwiseUnaryLayer instead
Sadik Armagan8b42a382019-03-01 14:24:49 +0000590table RsqrtLayer {
591 base:LayerBase;
592}
593
ruoyan018e7fa232019-02-28 15:09:07 +0000594table BatchNormalizationLayer {
595 base:LayerBase;
596 descriptor:BatchNormalizationDescriptor;
597 mean:ConstTensor;
598 variance:ConstTensor;
599 beta:ConstTensor;
600 gamma:ConstTensor;
601}
602
603table BatchNormalizationDescriptor {
604 eps:float;
605 dataLayout:DataLayout;
606}
607
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100608/// @deprecated Use ResizeLayer instead
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000609table ResizeBilinearLayer {
610 base:LayerBase;
611 descriptor:ResizeBilinearDescriptor;
612}
613
614table ResizeBilinearDescriptor {
615 targetWidth:uint;
616 targetHeight:uint;
617 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100618 alignCorners:bool;
619 halfPixelCenters:bool;
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000620}
621
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100622table SliceLayer {
623 base:LayerBase;
624 descriptor:SliceDescriptor;
625}
626
627table SliceDescriptor {
628 begin:[uint];
629 size:[uint];
630}
631
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000632table StridedSliceLayer {
633 base:LayerBase;
634 descriptor:StridedSliceDescriptor;
635}
636
637table StridedSliceDescriptor {
638 begin:[int];
639 end:[int];
640 stride:[int];
641 beginMask:int;
642 endMask:int;
643 shrinkAxisMask:int;
644 ellipsisMask:int;
645 newAxisMask:int;
646 dataLayout:DataLayout;
647}
648
Jim Flynne242f2d2019-05-22 14:24:13 +0100649table ConcatLayer {
650 base:LayerBase;
651 descriptor:OriginsDescriptor;
652}
653
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100654/// @deprecated Use ConcatLayer instead
Jim Flynnac25a1b2019-02-28 10:40:49 +0000655table MergerLayer {
656 base:LayerBase;
657 descriptor:OriginsDescriptor;
658}
659
660table UintVector {
661 data:[uint];
662}
663
664table OriginsDescriptor {
665 concatAxis:uint;
666 numViews:uint;
667 numDimensions:uint;
668 viewOrigins:[UintVector];
669}
670
Jim Flynn18ce3382019-03-08 11:08:30 +0000671table ViewsDescriptor {
672 origins:OriginsDescriptor;
673 viewSizes:[UintVector];
674}
675
676table SplitterLayer {
677 base:LayerBase;
678 descriptor:ViewsDescriptor;
679}
680
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000681table DetectionPostProcessLayer {
682 base:LayerBase;
683 descriptor:DetectionPostProcessDescriptor;
684 anchors:ConstTensor;
685}
686
687table DetectionPostProcessDescriptor {
688 maxDetections:uint;
689 maxClassesPerDetection:uint;
690 detectionsPerClass:uint;
691 nmsScoreThreshold:float;
692 nmsIouThreshold:float;
693 numClasses:uint;
694 useRegularNms:bool;
695 scaleX:float;
696 scaleY:float;
697 scaleW:float;
698 scaleH:float;
699}
700
Jim Flynn11af3752019-03-19 17:22:29 +0000701table LstmInputParams {
702 inputToForgetWeights:ConstTensor;
703 inputToCellWeights:ConstTensor;
704 inputToOutputWeights:ConstTensor;
705 recurrentToForgetWeights:ConstTensor;
706 recurrentToCellWeights:ConstTensor;
707 recurrentToOutputWeights:ConstTensor;
708 forgetGateBias:ConstTensor;
709 cellBias:ConstTensor;
710 outputGateBias:ConstTensor;
711
712 inputToInputWeights:ConstTensor;
713 recurrentToInputWeights:ConstTensor;
714 cellToInputWeights:ConstTensor;
715 inputGateBias:ConstTensor;
716
717 projectionWeights:ConstTensor;
718 projectionBias:ConstTensor;
719
720 cellToForgetWeights:ConstTensor;
721 cellToOutputWeights:ConstTensor;
Jan Eilersf8c62972019-07-17 11:07:49 +0100722
723 inputLayerNormWeights:ConstTensor;
724 forgetLayerNormWeights:ConstTensor;
725 cellLayerNormWeights:ConstTensor;
726 outputLayerNormWeights:ConstTensor;
Jim Flynn11af3752019-03-19 17:22:29 +0000727}
728
James Conroy8d333182020-05-13 10:27:58 +0100729table LstmDescriptor {
730 activationFunc:uint;
731 clippingThresCell:float;
732 clippingThresProj:float;
733 cifgEnabled:bool = true;
734 peepholeEnabled:bool = false;
735 projectionEnabled:bool = false;
736 layerNormEnabled:bool = false;
737}
738
739table LstmLayer {
740 base:LayerBase;
741 descriptor:LstmDescriptor;
742 inputParams:LstmInputParams;
743}
744
745table QLstmInputParams {
746 // Mandatory
747 inputToForgetWeights:ConstTensor;
748 inputToCellWeights:ConstTensor;
749 inputToOutputWeights:ConstTensor;
750
751 recurrentToForgetWeights:ConstTensor;
752 recurrentToCellWeights:ConstTensor;
753 recurrentToOutputWeights:ConstTensor;
754
755 forgetGateBias:ConstTensor;
756 cellBias:ConstTensor;
757 outputGateBias:ConstTensor;
758
759 // CIFG
760 inputToInputWeights:ConstTensor;
761 recurrentToInputWeights:ConstTensor;
762 inputGateBias:ConstTensor;
763
764 // Projection
765 projectionWeights:ConstTensor;
766 projectionBias:ConstTensor;
767
768 // Peephole
769 cellToInputWeights:ConstTensor;
770 cellToForgetWeights:ConstTensor;
771 cellToOutputWeights:ConstTensor;
772
773 // Layer norm
774 inputLayerNormWeights:ConstTensor;
775 forgetLayerNormWeights:ConstTensor;
776 cellLayerNormWeights:ConstTensor;
777 outputLayerNormWeights:ConstTensor;
778}
779
780table QLstmDescriptor {
781 cifgEnabled:bool = true;
782 peepholeEnabled:bool = false;
783 projectionEnabled:bool = false;
784 layerNormEnabled:bool = false;
785
786 cellClip:float;
787 projectionClip:float;
788
789 inputIntermediateScale:float;
790 forgetIntermediateScale:float;
791 cellIntermediateScale:float;
792 outputIntermediateScale:float;
793
794 hiddenStateZeroPoint:int;
795 hiddenStateScale:float;
796}
797
798table QLstmLayer {
799 base:LayerBase;
800 descriptor:QLstmDescriptor;
801 inputParams:QLstmInputParams;
802}
803
Jan Eilers5b01a892019-07-23 09:47:43 +0100804table QuantizedLstmInputParams {
805 inputToInputWeights:ConstTensor;
806 inputToForgetWeights:ConstTensor;
807 inputToCellWeights:ConstTensor;
808 inputToOutputWeights:ConstTensor;
809
810 recurrentToInputWeights:ConstTensor;
811 recurrentToForgetWeights:ConstTensor;
812 recurrentToCellWeights:ConstTensor;
813 recurrentToOutputWeights:ConstTensor;
814
815 inputGateBias:ConstTensor;
816 forgetGateBias:ConstTensor;
817 cellBias:ConstTensor;
818 outputGateBias:ConstTensor;
819}
820
Jan Eilers5b01a892019-07-23 09:47:43 +0100821table QuantizedLstmLayer {
822 base:LayerBase;
823 inputParams:QuantizedLstmInputParams;
824}
825
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000826table DequantizeLayer {
827 base:LayerBase;
828}
829
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100830table MergeLayer {
831 base:LayerBase;
832}
833
Sadik Armaganeff363d2019-04-05 15:25:46 +0100834table SwitchLayer {
835 base:LayerBase;
836}
837
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100838table PreluLayer {
839 base:LayerBase;
840}
841
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100842table TransposeConvolution2dLayer {
843 base:LayerBase;
844 descriptor:TransposeConvolution2dDescriptor;
845 weights:ConstTensor;
846 biases:ConstTensor;
847}
848
849table TransposeConvolution2dDescriptor {
850 padLeft:uint;
851 padRight:uint;
852 padTop:uint;
853 padBottom:uint;
854 strideX:uint;
855 strideY:uint;
856 biasEnabled:bool = false;
857 dataLayout:DataLayout = NCHW;
858}
859
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000860table TransposeLayer {
861 base:LayerBase;
862 descriptor:TransposeDescriptor;
863}
864
865table TransposeDescriptor {
866 dimMappings:[uint];
867}
868
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100869table ResizeLayer {
870 base:LayerBase;
871 descriptor:ResizeDescriptor;
872}
873
874table ResizeDescriptor {
875 targetHeight:uint;
876 targetWidth:uint;
877 method:ResizeMethod = NearestNeighbor;
878 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100879 alignCorners:bool;
880 halfPixelCenters:bool;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100881}
882
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100883table StackLayer {
884 base:LayerBase;
885 descriptor:StackDescriptor;
886}
887
888table StackDescriptor {
889 axis:uint;
890 numInputs:uint;
891 inputShape:[uint];
892}
893
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100894table StandInDescriptor {
895 numInputs:uint;
896 numOutputs:uint;
897}
898
899table StandInLayer {
900 base:LayerBase;
901 descriptor:StandInDescriptor;
902}
903
Finn Williams2605b232020-06-10 15:53:46 +0100904table RankLayer {
905 base:LayerBase;
906}
907
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000908table ReduceLayer {
909 base:LayerBase;
910 descriptor:ReduceDescriptor;
911}
912
913table ReduceDescriptor {
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000914 keepDims:bool = false;
915 axis:[uint];
916 reduceOperation:ReduceOperation = Sum;
917}
918
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100919table UnidirectionalSequenceLstmDescriptor {
920 activationFunc:uint;
921 clippingThresCell:float;
922 clippingThresProj:float;
923 cifgEnabled:bool = true;
924 peepholeEnabled:bool = false;
925 projectionEnabled:bool = false;
926 layerNormEnabled:bool = false;
927 timeMajor:bool = false;
928}
929
930table UnidirectionalSequenceLstmLayer {
931 base:LayerBase;
932 descriptor:UnidirectionalSequenceLstmDescriptor;
933 inputParams:LstmInputParams;
934}
935
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000936union Layer {
Mike Kellyaf484012019-02-20 16:53:11 +0000937 ActivationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000938 AdditionLayer,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000939 BatchToSpaceNdLayer,
ruoyan018e7fa232019-02-28 15:09:07 +0000940 BatchNormalizationLayer,
Conor Kennedy76277882019-02-26 08:29:54 +0000941 ConstantLayer,
Mike Kellya0766c32019-02-19 17:22:07 +0000942 Convolution2dLayer,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000943 DepthwiseConvolution2dLayer,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000944 FullyConnectedLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000945 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +0000946 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000947 OutputLayer,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000948 PermuteLayer,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000949 Pooling2dLayer,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000950 ReshapeLayer,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000951 SoftmaxLayer,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000952 SpaceToBatchNdLayer,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000953 DivisionLayer,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000954 MinimumLayer,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000955 EqualLayer,
Nina Drozd57728782019-02-27 10:53:27 +0000956 MaximumLayer,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000957 NormalizationLayer,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000958 PadLayer,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000959 RsqrtLayer,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000960 FloorLayer,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000961 GreaterLayer,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000962 ResizeBilinearLayer,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000963 SubtractionLayer,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000964 StridedSliceLayer,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000965 GatherLayer,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000966 MeanLayer,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000967 MergerLayer,
Jim Flynn18ce3382019-03-08 11:08:30 +0000968 L2NormalizationLayer,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000969 SplitterLayer,
Jim Flynn11af3752019-03-19 17:22:29 +0000970 DetectionPostProcessLayer,
Derek Lamberti87acb272019-03-27 16:51:31 +0000971 LstmLayer,
Jan Eilers5b01a892019-07-23 09:47:43 +0100972 QuantizedLstmLayer,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000973 QuantizeLayer,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100974 DequantizeLayer,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100975 MergeLayer,
Jim Flynne242f2d2019-05-22 14:24:13 +0100976 SwitchLayer,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100977 ConcatLayer,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100978 SpaceToDepthLayer,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100979 PreluLayer,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100980 TransposeConvolution2dLayer,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100981 ResizeLayer,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100982 StackLayer,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100983 AbsLayer,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100984 ArgMinMaxLayer,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100985 SliceLayer,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100986 DepthToSpaceLayer,
Sadik Armagan26257852019-10-14 13:00:47 +0100987 InstanceNormalizationLayer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100988 LogSoftmaxLayer,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100989 ComparisonLayer,
josh minor4a3c6102020-01-06 16:40:46 -0600990 StandInLayer,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000991 ElementwiseUnaryLayer,
James Conroy8d333182020-05-13 10:27:58 +0100992 TransposeLayer,
Keith Davis300ad562020-06-04 16:34:23 +0100993 QLstmLayer,
Finn Williams2605b232020-06-10 15:53:46 +0100994 FillLayer,
James Conroyaba90cd2020-11-06 16:28:18 +0000995 RankLayer,
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000996 LogicalBinaryLayer,
mathad01b392e982021-04-07 12:07:30 +0100997 ReduceLayer,
Keith Davis3ae3f972021-05-21 16:33:48 +0100998 CastLayer,
Narumol Prangnawarata0162e12021-07-23 14:47:49 +0100999 ShapeLayer,
1000 UnidirectionalSequenceLstmLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001001}
1002
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001003table AnyLayer {
1004 layer:Layer;
1005}
1006
Tee Jungaa920c52019-11-05 10:48:25 +00001007table FeatureCompatibilityVersions {
1008 bindingIdsScheme:uint = 0;
Jan Eilers53ef7952021-06-02 12:01:25 +01001009 weightsLayoutScheme:uint = 0;
Tee Jungaa920c52019-11-05 10:48:25 +00001010}
1011
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001012// Root type for serialized data is the graph of the network
1013table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +00001014 layers:[AnyLayer];
Tee Jungaa920c52019-11-05 10:48:25 +00001015 inputIds:[int];
1016 outputIds:[int];
1017 featureVersions:FeatureCompatibilityVersions;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001018}
1019
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +00001020root_type SerializedGraph;