blob: e1b6e1f7683b0c820fd762c3d5be3193f97d1fd4 [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,
42 QSymmS8 = 9
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000043}
44
Saoirse Stewart3166c3e2019-02-18 15:24:53 +000045enum DataLayout : byte {
46 NHWC = 0,
47 NCHW = 1
48}
49
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +010050enum ResizeMethod: byte {
51 NearestNeighbor = 0,
52 Bilinear = 1,
53}
54
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000055table TensorInfo {
56 dimensions:[uint];
57 dataType:DataType;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000058 quantizationScale:float = 1.0; // @deprecated Use quantizationScales instead
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000059 quantizationOffset:int = 0;
Sadik Armagan1a84fe32020-03-27 15:56:57 +000060 quantizationScales:[float];
61 quantizationDim:uint;
Finn Williams2605b232020-06-10 15:53:46 +010062 dimensionality:uint = 1;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000063}
64
65struct Connection {
66 sourceLayerIndex:uint;
67 outputSlotIndex:uint;
68}
69
70table ByteData {
71 data:[byte];
72}
73
74table ShortData {
75 data:[short];
76}
77
78table IntData {
79 data:[int];
80}
81
82table LongData {
83 data:[long];
84}
85
86union ConstTensorData { ByteData, ShortData, IntData, LongData }
87
88table ConstTensor {
89 info:TensorInfo;
90 data:ConstTensorData;
91}
92
93table InputSlot {
94 index:uint;
95 connection:Connection;
96}
97
98table OutputSlot {
99 index:uint;
100 tensorInfo:TensorInfo;
101}
102
103enum LayerType : uint {
104 Addition = 0,
105 Input = 1,
Sadik Armagan5f450272019-02-12 14:31:45 +0000106 Multiplication = 2,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000107 Output = 3,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000108 Pooling2d = 4,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000109 Reshape = 5,
Mike Kellya0766c32019-02-19 17:22:07 +0000110 Softmax = 6,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000111 Convolution2d = 7,
Mike Kellyaf484012019-02-20 16:53:11 +0000112 DepthwiseConvolution2d = 8,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000113 Activation = 9,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000114 Permute = 10,
Conor Kennedy76277882019-02-26 08:29:54 +0000115 FullyConnected = 11,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000116 Constant = 12,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000117 SpaceToBatchNd = 13,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000118 BatchToSpaceNd = 14,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000119 Division = 15,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000120 Minimum = 16,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000121 Equal = 17,
Nina Drozd57728782019-02-27 10:53:27 +0000122 Maximum = 18,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000123 Normalization = 19,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000124 Pad = 20,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000125 Rsqrt = 21,
ruoyan018e7fa232019-02-28 15:09:07 +0000126 Floor = 22,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000127 BatchNormalization = 23,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000128 Greater = 24,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000129 ResizeBilinear = 25,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000130 Subtraction = 26,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000131 StridedSlice = 27,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000132 Gather = 28,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000133 Mean = 29,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000134 Merger = 30,
Jim Flynn18ce3382019-03-08 11:08:30 +0000135 L2Normalization = 31,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000136 Splitter = 32,
Jim Flynn11af3752019-03-19 17:22:29 +0000137 DetectionPostProcess = 33,
Derek Lamberti87acb272019-03-27 16:51:31 +0000138 Lstm = 34,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000139 Quantize = 35,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100140 Dequantize = 36,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100141 Merge = 37,
Jim Flynne242f2d2019-05-22 14:24:13 +0100142 Switch = 38,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100143 Concat = 39,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100144 SpaceToDepth = 40,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100145 Prelu = 41,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100146 TransposeConvolution2d = 42,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100147 Resize = 43,
Jan Eilers5b01a892019-07-23 09:47:43 +0100148 Stack = 44,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100149 QuantizedLstm = 45,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100150 Abs = 46,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100151 ArgMinMax = 47,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100152 Slice = 48,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100153 DepthToSpace = 49,
Sadik Armagan26257852019-10-14 13:00:47 +0100154 InstanceNormalization = 50,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100155 LogSoftmax = 51,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100156 Comparison = 52,
josh minor4a3c6102020-01-06 16:40:46 -0600157 StandIn = 53,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000158 ElementwiseUnary = 54,
James Conroy8d333182020-05-13 10:27:58 +0100159 Transpose = 55,
Keith Davis300ad562020-06-04 16:34:23 +0100160 QLstm = 56,
Finn Williams2605b232020-06-10 15:53:46 +0100161 Fill = 57,
162 Rank = 58
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000163}
164
165// Base layer table to be used as part of other layers
166table LayerBase {
167 index:uint;
168 layerName:string;
169 layerType:LayerType;
170 inputSlots:[InputSlot];
171 outputSlots:[OutputSlot];
172}
173
174table BindableLayerBase {
175 base:LayerBase;
176 layerBindingId:int;
177}
178
179// Table for each layer defined below
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100180
josh minor4a3c6102020-01-06 16:40:46 -0600181/// @deprecated Use ElementwiseUnaryLayer instead
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100182table AbsLayer {
183 base:LayerBase;
184}
185
Mike Kellyaf484012019-02-20 16:53:11 +0000186table ActivationLayer {
187 base:LayerBase;
188 descriptor:ActivationDescriptor;
189}
190
191table ActivationDescriptor {
Tee Jung86bc3d82019-10-01 11:25:56 +0900192 activationFunction:ActivationFunction = Sigmoid;
Mike Kellyaf484012019-02-20 16:53:11 +0000193 a:float;
194 b:float;
195}
196
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000197table AdditionLayer {
198 base:LayerBase;
199}
200
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100201table ArgMinMaxLayer {
202 base:LayerBase;
203 descriptor:ArgMinMaxDescriptor;
204}
205
206table ArgMinMaxDescriptor{
Tee Jung86bc3d82019-10-01 11:25:56 +0900207 argMinMaxFunction:ArgMinMaxFunction;
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100208 axis:int;
209}
210
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100211enum ComparisonOperation : byte {
212 Equal = 0,
213 Greater = 1,
214 GreaterOrEqual = 2,
215 Less = 3,
216 LessOrEqual = 4,
217 NotEqual = 5
218}
219
220table ComparisonDescriptor {
221 operation:ComparisonOperation;
222}
223
224table ComparisonLayer {
225 base:LayerBase;
226 descriptor:ComparisonDescriptor;
227}
228
Conor Kennedy76277882019-02-26 08:29:54 +0000229table ConstantLayer {
230 base:LayerBase;
231 input:ConstTensor;
232}
233
Mike Kellya0766c32019-02-19 17:22:07 +0000234table Convolution2dLayer {
235 base:LayerBase;
236 descriptor:Convolution2dDescriptor;
237 weights:ConstTensor;
238 biases:ConstTensor;
239}
240
241table Convolution2dDescriptor {
242 padLeft:uint;
243 padRight:uint;
244 padTop:uint;
245 padBottom:uint;
246 strideX:uint;
247 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100248 dilationX:uint = 1;
249 dilationY:uint = 1;
Mike Kellya0766c32019-02-19 17:22:07 +0000250 biasEnabled:bool = false;
251 dataLayout:DataLayout = NCHW;
252}
253
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100254table DepthToSpaceLayer {
255 base:LayerBase;
256 descriptor:DepthToSpaceDescriptor;
257}
258
259table DepthToSpaceDescriptor {
260 blockSize:uint;
261 dataLayout:DataLayout;
262}
263
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000264table DivisionLayer {
265 base:LayerBase;
266}
267
josh minor4a3c6102020-01-06 16:40:46 -0600268enum UnaryOperation : byte {
269 Abs = 0,
270 Rsqrt = 1,
271 Sqrt = 2,
272 Exp = 3,
273 Neg = 4
274}
275
276table ElementwiseUnaryDescriptor {
277 operation:UnaryOperation;
278}
279
280table ElementwiseUnaryLayer {
281 base:LayerBase;
282 descriptor:ElementwiseUnaryDescriptor;
283}
284
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100285/// @deprecated Use ComparisonLayer instead
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000286table EqualLayer {
287 base:LayerBase;
288}
289
Keith Davis300ad562020-06-04 16:34:23 +0100290table FillLayer {
291 base:LayerBase;
292 descriptor:FillDescriptor;
293}
294
295table FillDescriptor {
296 value:float;
297}
298
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000299table FloorLayer{
300 base:LayerBase;
301}
302
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000303table FullyConnectedLayer {
304 base:LayerBase;
305 descriptor:FullyConnectedDescriptor;
306 weights:ConstTensor;
307 biases:ConstTensor;
308}
309
310table FullyConnectedDescriptor {
311 biasEnabled:bool = false;
312 transposeWeightsMatrix:bool = false;
313}
314
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000315table GatherLayer {
316 base:LayerBase;
Teresa Charlin52664732020-06-29 16:27:03 +0100317 descriptor:GatherDescriptor;
318}
319
320table GatherDescriptor {
321 axis:int = 0;
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000322}
323
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100324/// @deprecated Use ComparisonLayer instead
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000325table GreaterLayer {
326 base:LayerBase;
327}
328
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000329table InputLayer {
330 base:BindableLayerBase;
331}
332
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100333table InstanceNormalizationLayer {
334 base:LayerBase;
335 descriptor:InstanceNormalizationDescriptor;
336}
337
338table InstanceNormalizationDescriptor {
339 gamma:float;
340 beta:float;
341 eps:float;
342 dataLayout:DataLayout;
343}
344
Sadik Armagan26257852019-10-14 13:00:47 +0100345table LogSoftmaxLayer {
346 base:LayerBase;
347 descriptor:LogSoftmaxDescriptor;
348}
349
350table LogSoftmaxDescriptor {
351 beta:float = 1;
352 axis:int = -1;
353}
354
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000355table L2NormalizationLayer {
356 base:LayerBase;
357 descriptor:L2NormalizationDescriptor;
358}
359
360table L2NormalizationDescriptor {
361 dataLayout:DataLayout = NCHW;
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100362 eps:float = 1e-12;
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000363}
364
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000365table MinimumLayer {
366 base:LayerBase;
367}
368
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000369table MaximumLayer {
370 base:LayerBase;
371}
372
Sadik Armagan5f450272019-02-12 14:31:45 +0000373table MultiplicationLayer {
374 base:LayerBase;
375}
376
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000377table Pooling2dLayer {
378 base:LayerBase;
379 descriptor:Pooling2dDescriptor;
380}
381
382enum PoolingAlgorithm : byte {
383 Max = 0,
384 Average = 1,
385 L2 = 2
386}
387
388enum OutputShapeRounding : byte {
389 Floor = 0,
390 Ceiling = 1
391}
392
393enum PaddingMethod : byte {
394 IgnoreValue = 0,
395 Exclude = 1
396}
397
398table Pooling2dDescriptor {
399 poolType:PoolingAlgorithm;
400 padLeft:uint;
401 padRight:uint;
402 padTop:uint;
403 padBottom:uint;
404 poolWidth:uint;
405 poolHeight:uint;
406 strideX:uint;
407 strideY:uint;
408 outputShapeRounding:OutputShapeRounding;
409 paddingMethod:PaddingMethod;
410 dataLayout:DataLayout;
411}
412
Derek Lamberti87acb272019-03-27 16:51:31 +0000413table QuantizeLayer {
414 base:LayerBase;
415}
416
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000417table SoftmaxLayer {
418 base:LayerBase;
419 descriptor:SoftmaxDescriptor;
420}
421
422table SoftmaxDescriptor {
423 beta:float;
424}
425
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000426table DepthwiseConvolution2dLayer {
427 base:LayerBase;
428 descriptor:DepthwiseConvolution2dDescriptor;
429 weights:ConstTensor;
430 biases:ConstTensor;
431}
432
433table DepthwiseConvolution2dDescriptor {
434 padLeft:uint;
435 padRight:uint;
436 padTop:uint;
437 padBottom:uint;
438 strideX:uint;
439 strideY:uint;
Matthew Benthamacad04e2019-05-13 10:02:45 +0100440 dilationX:uint = 1;
441 dilationY:uint = 1;
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000442 biasEnabled:bool = false;
443 dataLayout:DataLayout = NCHW;
444}
445
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000446table OutputLayer {
447 base:BindableLayerBase;
448}
449
Saoirse Stewart263829c2019-02-19 15:54:14 +0000450table ReshapeLayer {
451 base:LayerBase;
452 descriptor:ReshapeDescriptor;
453}
454
455table ReshapeDescriptor {
456 targetShape:[uint];
457}
458
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000459table PermuteLayer {
460 base:LayerBase;
461 descriptor:PermuteDescriptor;
462}
463
464table PermuteDescriptor {
465 dimMappings:[uint];
466}
467
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000468table SpaceToBatchNdLayer {
469 base:LayerBase;
470 descriptor:SpaceToBatchNdDescriptor;
471}
472
473table SpaceToBatchNdDescriptor {
474 blockShape:[uint];
475 padList:[uint];
476 dataLayout:DataLayout;
477}
478
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100479table SpaceToDepthLayer {
480 base:LayerBase;
481 descriptor:SpaceToDepthDescriptor;
482}
483
484table SpaceToDepthDescriptor {
485 blockSize:uint;
486 dataLayout:DataLayout;
487}
488
Conor Kennedyda1f9752019-03-01 14:37:12 +0000489table SubtractionLayer {
490 base:LayerBase;
491}
492
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000493table BatchToSpaceNdLayer {
494 base:LayerBase;
495 descriptor:BatchToSpaceNdDescriptor;
496}
497
498table BatchToSpaceNdDescriptor {
499 blockShape:[uint];
500 crops:[uint];
501 dataLayout:DataLayout;
502}
503
Nina Drozd57728782019-02-27 10:53:27 +0000504enum NormalizationAlgorithmChannel : byte {
505 Across = 0,
506 Within = 1
507}
508
509enum NormalizationAlgorithmMethod : byte {
510 LocalBrightness = 0,
511 LocalContrast = 1
512}
513
514table NormalizationLayer {
515 base:LayerBase;
516 descriptor:NormalizationDescriptor;
517}
518
519table NormalizationDescriptor {
520 normChannelType:NormalizationAlgorithmChannel = Across;
521 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
522 normSize:uint;
523 alpha:float;
524 beta:float;
525 k:float;
526 dataLayout:DataLayout = NCHW;
527}
528
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000529table MeanLayer {
530 base:LayerBase;
531 descriptor:MeanDescriptor;
532}
533
534table MeanDescriptor {
535 axis:[uint];
536 keepDims:bool = false;
537}
538
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000539table PadLayer {
540 base:LayerBase;
541 descriptor:PadDescriptor;
542}
543
544table PadDescriptor {
545 padList:[uint];
David Monahan34757812019-06-19 11:47:21 +0100546 padValue:float = 0;
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000547}
548
josh minor4a3c6102020-01-06 16:40:46 -0600549/// @deprecated Use ElementwiseUnaryLayer instead
Sadik Armagan8b42a382019-03-01 14:24:49 +0000550table RsqrtLayer {
551 base:LayerBase;
552}
553
ruoyan018e7fa232019-02-28 15:09:07 +0000554table BatchNormalizationLayer {
555 base:LayerBase;
556 descriptor:BatchNormalizationDescriptor;
557 mean:ConstTensor;
558 variance:ConstTensor;
559 beta:ConstTensor;
560 gamma:ConstTensor;
561}
562
563table BatchNormalizationDescriptor {
564 eps:float;
565 dataLayout:DataLayout;
566}
567
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100568/// @deprecated Use ResizeLayer instead
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000569table ResizeBilinearLayer {
570 base:LayerBase;
571 descriptor:ResizeBilinearDescriptor;
572}
573
574table ResizeBilinearDescriptor {
575 targetWidth:uint;
576 targetHeight:uint;
577 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100578 alignCorners:bool;
579 halfPixelCenters:bool;
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000580}
581
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100582table SliceLayer {
583 base:LayerBase;
584 descriptor:SliceDescriptor;
585}
586
587table SliceDescriptor {
588 begin:[uint];
589 size:[uint];
590}
591
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000592table StridedSliceLayer {
593 base:LayerBase;
594 descriptor:StridedSliceDescriptor;
595}
596
597table StridedSliceDescriptor {
598 begin:[int];
599 end:[int];
600 stride:[int];
601 beginMask:int;
602 endMask:int;
603 shrinkAxisMask:int;
604 ellipsisMask:int;
605 newAxisMask:int;
606 dataLayout:DataLayout;
607}
608
Jim Flynne242f2d2019-05-22 14:24:13 +0100609table ConcatLayer {
610 base:LayerBase;
611 descriptor:OriginsDescriptor;
612}
613
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100614/// @deprecated Use ConcatLayer instead
Jim Flynnac25a1b2019-02-28 10:40:49 +0000615table MergerLayer {
616 base:LayerBase;
617 descriptor:OriginsDescriptor;
618}
619
620table UintVector {
621 data:[uint];
622}
623
624table OriginsDescriptor {
625 concatAxis:uint;
626 numViews:uint;
627 numDimensions:uint;
628 viewOrigins:[UintVector];
629}
630
Jim Flynn18ce3382019-03-08 11:08:30 +0000631table ViewsDescriptor {
632 origins:OriginsDescriptor;
633 viewSizes:[UintVector];
634}
635
636table SplitterLayer {
637 base:LayerBase;
638 descriptor:ViewsDescriptor;
639}
640
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000641table DetectionPostProcessLayer {
642 base:LayerBase;
643 descriptor:DetectionPostProcessDescriptor;
644 anchors:ConstTensor;
645}
646
647table DetectionPostProcessDescriptor {
648 maxDetections:uint;
649 maxClassesPerDetection:uint;
650 detectionsPerClass:uint;
651 nmsScoreThreshold:float;
652 nmsIouThreshold:float;
653 numClasses:uint;
654 useRegularNms:bool;
655 scaleX:float;
656 scaleY:float;
657 scaleW:float;
658 scaleH:float;
659}
660
Jim Flynn11af3752019-03-19 17:22:29 +0000661table LstmInputParams {
662 inputToForgetWeights:ConstTensor;
663 inputToCellWeights:ConstTensor;
664 inputToOutputWeights:ConstTensor;
665 recurrentToForgetWeights:ConstTensor;
666 recurrentToCellWeights:ConstTensor;
667 recurrentToOutputWeights:ConstTensor;
668 forgetGateBias:ConstTensor;
669 cellBias:ConstTensor;
670 outputGateBias:ConstTensor;
671
672 inputToInputWeights:ConstTensor;
673 recurrentToInputWeights:ConstTensor;
674 cellToInputWeights:ConstTensor;
675 inputGateBias:ConstTensor;
676
677 projectionWeights:ConstTensor;
678 projectionBias:ConstTensor;
679
680 cellToForgetWeights:ConstTensor;
681 cellToOutputWeights:ConstTensor;
Jan Eilersf8c62972019-07-17 11:07:49 +0100682
683 inputLayerNormWeights:ConstTensor;
684 forgetLayerNormWeights:ConstTensor;
685 cellLayerNormWeights:ConstTensor;
686 outputLayerNormWeights:ConstTensor;
Jim Flynn11af3752019-03-19 17:22:29 +0000687}
688
James Conroy8d333182020-05-13 10:27:58 +0100689table LstmDescriptor {
690 activationFunc:uint;
691 clippingThresCell:float;
692 clippingThresProj:float;
693 cifgEnabled:bool = true;
694 peepholeEnabled:bool = false;
695 projectionEnabled:bool = false;
696 layerNormEnabled:bool = false;
697}
698
699table LstmLayer {
700 base:LayerBase;
701 descriptor:LstmDescriptor;
702 inputParams:LstmInputParams;
703}
704
705table QLstmInputParams {
706 // Mandatory
707 inputToForgetWeights:ConstTensor;
708 inputToCellWeights:ConstTensor;
709 inputToOutputWeights:ConstTensor;
710
711 recurrentToForgetWeights:ConstTensor;
712 recurrentToCellWeights:ConstTensor;
713 recurrentToOutputWeights:ConstTensor;
714
715 forgetGateBias:ConstTensor;
716 cellBias:ConstTensor;
717 outputGateBias:ConstTensor;
718
719 // CIFG
720 inputToInputWeights:ConstTensor;
721 recurrentToInputWeights:ConstTensor;
722 inputGateBias:ConstTensor;
723
724 // Projection
725 projectionWeights:ConstTensor;
726 projectionBias:ConstTensor;
727
728 // Peephole
729 cellToInputWeights:ConstTensor;
730 cellToForgetWeights:ConstTensor;
731 cellToOutputWeights:ConstTensor;
732
733 // Layer norm
734 inputLayerNormWeights:ConstTensor;
735 forgetLayerNormWeights:ConstTensor;
736 cellLayerNormWeights:ConstTensor;
737 outputLayerNormWeights:ConstTensor;
738}
739
740table QLstmDescriptor {
741 cifgEnabled:bool = true;
742 peepholeEnabled:bool = false;
743 projectionEnabled:bool = false;
744 layerNormEnabled:bool = false;
745
746 cellClip:float;
747 projectionClip:float;
748
749 inputIntermediateScale:float;
750 forgetIntermediateScale:float;
751 cellIntermediateScale:float;
752 outputIntermediateScale:float;
753
754 hiddenStateZeroPoint:int;
755 hiddenStateScale:float;
756}
757
758table QLstmLayer {
759 base:LayerBase;
760 descriptor:QLstmDescriptor;
761 inputParams:QLstmInputParams;
762}
763
Jan Eilers5b01a892019-07-23 09:47:43 +0100764table QuantizedLstmInputParams {
765 inputToInputWeights:ConstTensor;
766 inputToForgetWeights:ConstTensor;
767 inputToCellWeights:ConstTensor;
768 inputToOutputWeights:ConstTensor;
769
770 recurrentToInputWeights:ConstTensor;
771 recurrentToForgetWeights:ConstTensor;
772 recurrentToCellWeights:ConstTensor;
773 recurrentToOutputWeights:ConstTensor;
774
775 inputGateBias:ConstTensor;
776 forgetGateBias:ConstTensor;
777 cellBias:ConstTensor;
778 outputGateBias:ConstTensor;
779}
780
Jan Eilers5b01a892019-07-23 09:47:43 +0100781table QuantizedLstmLayer {
782 base:LayerBase;
783 inputParams:QuantizedLstmInputParams;
784}
785
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000786table DequantizeLayer {
787 base:LayerBase;
788}
789
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100790table MergeLayer {
791 base:LayerBase;
792}
793
Sadik Armaganeff363d2019-04-05 15:25:46 +0100794table SwitchLayer {
795 base:LayerBase;
796}
797
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100798table PreluLayer {
799 base:LayerBase;
800}
801
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100802table TransposeConvolution2dLayer {
803 base:LayerBase;
804 descriptor:TransposeConvolution2dDescriptor;
805 weights:ConstTensor;
806 biases:ConstTensor;
807}
808
809table TransposeConvolution2dDescriptor {
810 padLeft:uint;
811 padRight:uint;
812 padTop:uint;
813 padBottom:uint;
814 strideX:uint;
815 strideY:uint;
816 biasEnabled:bool = false;
817 dataLayout:DataLayout = NCHW;
818}
819
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000820table TransposeLayer {
821 base:LayerBase;
822 descriptor:TransposeDescriptor;
823}
824
825table TransposeDescriptor {
826 dimMappings:[uint];
827}
828
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100829table ResizeLayer {
830 base:LayerBase;
831 descriptor:ResizeDescriptor;
832}
833
834table ResizeDescriptor {
835 targetHeight:uint;
836 targetWidth:uint;
837 method:ResizeMethod = NearestNeighbor;
838 dataLayout:DataLayout;
David Monahan4a0c9b92020-05-30 09:48:39 +0100839 alignCorners:bool;
840 halfPixelCenters:bool;
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100841}
842
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100843table StackLayer {
844 base:LayerBase;
845 descriptor:StackDescriptor;
846}
847
848table StackDescriptor {
849 axis:uint;
850 numInputs:uint;
851 inputShape:[uint];
852}
853
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100854table StandInDescriptor {
855 numInputs:uint;
856 numOutputs:uint;
857}
858
859table StandInLayer {
860 base:LayerBase;
861 descriptor:StandInDescriptor;
862}
863
Finn Williams2605b232020-06-10 15:53:46 +0100864table RankLayer {
865 base:LayerBase;
866}
867
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000868union Layer {
Mike Kellyaf484012019-02-20 16:53:11 +0000869 ActivationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000870 AdditionLayer,
Nattapat Chaimanowong6b4ed982019-02-26 17:24:13 +0000871 BatchToSpaceNdLayer,
ruoyan018e7fa232019-02-28 15:09:07 +0000872 BatchNormalizationLayer,
Conor Kennedy76277882019-02-26 08:29:54 +0000873 ConstantLayer,
Mike Kellya0766c32019-02-19 17:22:07 +0000874 Convolution2dLayer,
Aron Virginas-Tarc04125f2019-02-19 16:31:08 +0000875 DepthwiseConvolution2dLayer,
Sadik Armagandbb0c0c2019-02-21 09:01:41 +0000876 FullyConnectedLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000877 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +0000878 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000879 OutputLayer,
Nattapat Chaimanowong30b00202019-02-20 17:31:34 +0000880 PermuteLayer,
Saoirse Stewart3166c3e2019-02-18 15:24:53 +0000881 Pooling2dLayer,
Saoirse Stewart263829c2019-02-19 15:54:14 +0000882 ReshapeLayer,
Nattapat Chaimanowong45286992019-02-26 15:53:02 +0000883 SoftmaxLayer,
Éanna Ó Catháin58885892019-02-27 16:16:39 +0000884 SpaceToBatchNdLayer,
Aron Virginas-Tar0fe32452019-02-28 13:12:47 +0000885 DivisionLayer,
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +0000886 MinimumLayer,
Aron Virginas-Tar377351e2019-02-27 14:42:31 +0000887 EqualLayer,
Nina Drozd57728782019-02-27 10:53:27 +0000888 MaximumLayer,
Nattapat Chaimanowongebb0f9c2019-03-01 12:14:06 +0000889 NormalizationLayer,
Sadik Armagan8b42a382019-03-01 14:24:49 +0000890 PadLayer,
Finn Williamsdd2ba7e2019-03-01 11:51:52 +0000891 RsqrtLayer,
Conor Kennedy79ffdf52019-03-01 14:24:54 +0000892 FloorLayer,
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000893 GreaterLayer,
Conor Kennedyda1f9752019-03-01 14:37:12 +0000894 ResizeBilinearLayer,
Nattapat Chaimanowongb3485212019-03-04 12:35:39 +0000895 SubtractionLayer,
Saoirse Stewarta1ed73a2019-03-04 13:40:12 +0000896 StridedSliceLayer,
Sadik Armaganac97c8c2019-03-04 17:44:21 +0000897 GatherLayer,
Jim Flynnac25a1b2019-02-28 10:40:49 +0000898 MeanLayer,
Narumol Prangnawarat495701f2019-03-07 17:31:34 +0000899 MergerLayer,
Jim Flynn18ce3382019-03-08 11:08:30 +0000900 L2NormalizationLayer,
Nattapat Chaimanowong3e14a9d2019-03-18 12:37:06 +0000901 SplitterLayer,
Jim Flynn11af3752019-03-19 17:22:29 +0000902 DetectionPostProcessLayer,
Derek Lamberti87acb272019-03-27 16:51:31 +0000903 LstmLayer,
Jan Eilers5b01a892019-07-23 09:47:43 +0100904 QuantizedLstmLayer,
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000905 QuantizeLayer,
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100906 DequantizeLayer,
Sadik Armaganeff363d2019-04-05 15:25:46 +0100907 MergeLayer,
Jim Flynne242f2d2019-05-22 14:24:13 +0100908 SwitchLayer,
Aron Virginas-Taraa067142019-06-11 16:01:44 +0100909 ConcatLayer,
Ellen Norris-Thompson51982472019-06-19 11:46:21 +0100910 SpaceToDepthLayer,
Aron Virginas-Tarcb549302019-06-21 13:53:38 +0100911 PreluLayer,
FinnWilliamsArm6fb339a2019-06-28 15:07:10 +0100912 TransposeConvolution2dLayer,
Matthew Jacksonb5433ee2019-07-11 15:54:20 +0100913 ResizeLayer,
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100914 StackLayer,
Narumol Prangnawarat0cfcf232019-09-09 17:16:24 +0100915 AbsLayer,
Aron Virginas-Tar2fda80b2019-09-18 13:36:52 +0100916 ArgMinMaxLayer,
Aron Virginas-Tarda9d2d32019-09-20 10:42:02 +0100917 SliceLayer,
Aron Virginas-Tar781ced92019-10-03 11:15:39 +0100918 DepthToSpaceLayer,
Sadik Armagan26257852019-10-14 13:00:47 +0100919 InstanceNormalizationLayer,
Aron Virginas-Tare80ebd12019-10-17 16:11:54 +0100920 LogSoftmaxLayer,
Aron Virginas-Tar85121a22019-10-23 10:41:35 +0100921 ComparisonLayer,
josh minor4a3c6102020-01-06 16:40:46 -0600922 StandInLayer,
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000923 ElementwiseUnaryLayer,
James Conroy8d333182020-05-13 10:27:58 +0100924 TransposeLayer,
Keith Davis300ad562020-06-04 16:34:23 +0100925 QLstmLayer,
Finn Williams2605b232020-06-10 15:53:46 +0100926 FillLayer,
927 RankLayer
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000928}
929
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000930table AnyLayer {
931 layer:Layer;
932}
933
Tee Jungaa920c52019-11-05 10:48:25 +0000934table FeatureCompatibilityVersions {
935 bindingIdsScheme:uint = 0;
936}
937
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000938// Root type for serialized data is the graph of the network
939table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000940 layers:[AnyLayer];
Tee Jungaa920c52019-11-05 10:48:25 +0000941 inputIds:[int];
942 outputIds:[int];
943 featureVersions:FeatureCompatibilityVersions;
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000944}
945
Keith Davis300ad562020-06-04 16:34:23 +0100946root_type SerializedGraph;