xref: /aosp_15_r20/external/armnn/src/armnnSerializer/ArmnnSchema.fbs (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1//
2// Copyright © 2017,2019-2023 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6namespace armnnSerializer;
7
8file_identifier "ARMN";
9
10file_extension "armnn";
11
12enum 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,
22    Square = 9,
23    Elu = 10,
24    HardSwish = 11
25}
26
27enum ArgMinMaxFunction : byte {
28    Min = 0,
29    Max = 1
30}
31
32enum DataType : byte {
33    Float16 = 0,
34    Float32 = 1,
35    QuantisedAsymm8 = 2, // deprecated
36    Signed32 = 3,
37    Boolean = 4,
38    QuantisedSymm16 = 5, // deprecated
39    QAsymmU8 = 6,
40    QSymmS16 = 7,
41    QAsymmS8 = 8,
42    QSymmS8 = 9,
43    Signed64 = 10
44}
45
46enum DataLayout : byte {
47    NHWC = 0,
48    NCHW = 1,
49    NDHWC = 2,
50    NCDHW = 3
51}
52
53enum ReduceOperation: byte {
54    Sum  = 0,
55    Max  = 1,
56    Mean = 2,
57    Min  = 3,
58    Prod  = 4
59}
60
61enum ResizeMethod: byte {
62    NearestNeighbor = 0,
63    Bilinear = 1,
64}
65
66table TensorInfo {
67    dimensions:[uint];
68    dataType:DataType;
69    quantizationScale:float = 1.0; // @deprecated Use quantizationScales instead
70    quantizationOffset:int = 0;
71    quantizationScales:[float];
72    quantizationDim:uint;
73    dimensionality:uint = 1;
74    dimensionSpecificity:[bool];
75    isConstant:bool = false;
76}
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,
119    Multiplication = 2,
120    Output = 3,
121    Pooling2d = 4,
122    Reshape = 5,
123    Softmax = 6,
124    Convolution2d = 7,
125    DepthwiseConvolution2d = 8,
126    Activation = 9,
127    Permute = 10,
128    FullyConnected = 11,
129    Constant = 12,
130    SpaceToBatchNd = 13,
131    BatchToSpaceNd = 14,
132    Division = 15,
133    Minimum = 16,
134    Equal = 17,
135    Maximum = 18,
136    Normalization = 19,
137    Pad = 20,
138    Rsqrt = 21,
139    Floor = 22,
140    BatchNormalization = 23,
141    Greater = 24,
142    ResizeBilinear = 25,
143    Subtraction = 26,
144    StridedSlice = 27,
145    Gather = 28,
146    Mean = 29,
147    Merger = 30,
148    L2Normalization = 31,
149    Splitter = 32,
150    DetectionPostProcess = 33,
151    Lstm = 34,
152    Quantize = 35,
153    Dequantize = 36,
154    Merge = 37,
155    Switch = 38,
156    Concat = 39,
157    SpaceToDepth = 40,
158    Prelu = 41,
159    TransposeConvolution2d = 42,
160    Resize = 43,
161    Stack = 44,
162    QuantizedLstm = 45,
163    Abs = 46,
164    ArgMinMax = 47,
165    Slice = 48,
166    DepthToSpace = 49,
167    InstanceNormalization = 50,
168    LogSoftmax = 51,
169    Comparison = 52,
170    StandIn = 53,
171    ElementwiseUnary = 54,
172    Transpose = 55,
173    QLstm = 56,
174    Fill = 57,
175    Rank = 58,
176    LogicalBinary = 59,
177    Reduce = 60,
178    Cast = 61,
179    Shape = 62,
180    UnidirectionalSequenceLstm = 63,
181    ChannelShuffle = 64,
182    Convolution3d = 65,
183    Pooling3d = 66,
184    GatherNd = 67,
185    BatchMatMul = 68,
186    ElementwiseBinary = 69,
187}
188
189// Base layer table to be used as part of other layers
190table LayerBase {
191    index:uint;
192    layerName:string;
193    layerType:LayerType;
194    inputSlots:[InputSlot];
195    outputSlots:[OutputSlot];
196}
197
198table BindableLayerBase {
199    base:LayerBase;
200    layerBindingId:int;
201}
202
203// Table for each layer defined below
204
205/// @deprecated Use ElementwiseUnaryLayer instead
206table AbsLayer {
207    base:LayerBase;
208}
209
210table ActivationLayer {
211    base:LayerBase;
212    descriptor:ActivationDescriptor;
213}
214
215table ActivationDescriptor {
216    activationFunction:ActivationFunction = Sigmoid;
217    a:float;
218    b:float;
219}
220
221table AdditionLayer {
222    base:LayerBase;
223}
224
225table ArgMinMaxLayer {
226    base:LayerBase;
227    descriptor:ArgMinMaxDescriptor;
228}
229
230table ArgMinMaxDescriptor{
231    argMinMaxFunction:ArgMinMaxFunction;
232    axis:int;
233}
234
235table CastLayer {
236    base:LayerBase;
237}
238
239table ChannelShuffleLayer {
240    base:LayerBase;
241    descriptor:ChannelShuffleDescriptor;
242}
243
244table ChannelShuffleDescriptor {
245    axis:uint = 0;
246    numGroups:uint = 0;
247}
248
249enum ComparisonOperation : byte {
250    Equal = 0,
251    Greater = 1,
252    GreaterOrEqual = 2,
253    Less = 3,
254    LessOrEqual = 4,
255    NotEqual = 5
256}
257
258table ComparisonDescriptor {
259    operation:ComparisonOperation;
260}
261
262table ComparisonLayer {
263    base:LayerBase;
264    descriptor:ComparisonDescriptor;
265}
266
267table ConstantLayer {
268    base:LayerBase;
269    input:ConstTensor;
270}
271
272table Convolution2dLayer {
273    base:LayerBase;
274    descriptor:Convolution2dDescriptor;
275    weights:ConstTensor;
276    biases:ConstTensor;
277}
278
279table Convolution2dDescriptor {
280    padLeft:uint;
281    padRight:uint;
282    padTop:uint;
283    padBottom:uint;
284    strideX:uint;
285    strideY:uint;
286    dilationX:uint = 1;
287    dilationY:uint = 1;
288    biasEnabled:bool = false;
289    dataLayout:DataLayout = NCHW;
290}
291
292table Convolution3dLayer {
293    base:LayerBase;
294    descriptor:Convolution3dDescriptor;
295}
296
297table Convolution3dDescriptor {
298    padLeft:uint;
299    padRight:uint;
300    padTop:uint;
301    padBottom:uint;
302    padFront:uint;
303    padBack:uint;
304    strideX:uint;
305    strideY:uint;
306    strideZ:uint;
307    dilationX:uint = 1;
308    dilationY:uint = 1;
309    dilationZ:uint = 1;
310    biasEnabled:bool = false;
311    dataLayout:DataLayout = NDHWC;
312}
313
314table DepthToSpaceLayer {
315    base:LayerBase;
316    descriptor:DepthToSpaceDescriptor;
317}
318
319table DepthToSpaceDescriptor {
320    blockSize:uint;
321    dataLayout:DataLayout;
322}
323
324table DivisionLayer {
325    base:LayerBase;
326}
327
328enum BinaryOperation : byte {
329    Add     = 0,
330    Div     = 1,
331    Maximum = 2,
332    Minimum = 3,
333    Mul     = 4,
334    Sub     = 5
335}
336
337table ElementwiseBinaryDescriptor {
338    operation:BinaryOperation;
339}
340
341table ElementwiseBinaryLayer {
342    base:LayerBase;
343    descriptor:ElementwiseBinaryDescriptor;
344}
345
346enum UnaryOperation : byte {
347    Abs = 0,
348    Rsqrt = 1,
349    Sqrt = 2,
350    Exp = 3,
351    Neg = 4,
352    LogicalNot = 5,
353    Log = 6,
354    Sin = 7,
355    Ceil = 8
356}
357
358table ElementwiseUnaryDescriptor {
359    operation:UnaryOperation;
360}
361
362table ElementwiseUnaryLayer {
363    base:LayerBase;
364    descriptor:ElementwiseUnaryDescriptor;
365}
366
367/// @deprecated Use ComparisonLayer instead
368table EqualLayer {
369    base:LayerBase;
370}
371
372table FillLayer {
373    base:LayerBase;
374    descriptor:FillDescriptor;
375}
376
377table FillDescriptor {
378    value:float;
379}
380
381table FloorLayer{
382    base:LayerBase;
383}
384
385table FullyConnectedLayer {
386    base:LayerBase;
387    descriptor:FullyConnectedDescriptor;
388    weights:ConstTensor; // ConstTensors are now passed as inputs.
389    biases:ConstTensor;
390}
391
392table FullyConnectedDescriptor {
393    biasEnabled:bool = false;
394    transposeWeightsMatrix:bool = false;
395    constantWeights:bool = true;
396}
397
398table GatherLayer {
399    base:LayerBase;
400    descriptor:GatherDescriptor;
401}
402
403table GatherDescriptor {
404    axis:int = 0;
405}
406
407table GatherNdLayer {
408    base:LayerBase;
409}
410
411/// @deprecated Use ComparisonLayer instead
412table GreaterLayer {
413    base:LayerBase;
414}
415
416table InputLayer {
417    base:BindableLayerBase;
418}
419
420table InstanceNormalizationLayer {
421    base:LayerBase;
422    descriptor:InstanceNormalizationDescriptor;
423}
424
425table InstanceNormalizationDescriptor {
426    gamma:float;
427    beta:float;
428    eps:float;
429    dataLayout:DataLayout;
430}
431
432table LogSoftmaxLayer {
433    base:LayerBase;
434    descriptor:LogSoftmaxDescriptor;
435}
436
437table LogSoftmaxDescriptor {
438    beta:float = 1;
439    axis:int = -1;
440}
441
442table L2NormalizationLayer {
443    base:LayerBase;
444    descriptor:L2NormalizationDescriptor;
445}
446
447table L2NormalizationDescriptor {
448    dataLayout:DataLayout = NCHW;
449    eps:float = 1e-12;
450}
451
452enum LogicalBinaryOperation : byte {
453    LogicalAnd = 0,
454    LogicalOr = 1
455}
456
457table LogicalBinaryDescriptor {
458    operation:LogicalBinaryOperation;
459}
460
461table LogicalBinaryLayer {
462    base:LayerBase;
463    descriptor:LogicalBinaryDescriptor;
464}
465
466table MinimumLayer {
467    base:LayerBase;
468}
469
470table MaximumLayer {
471    base:LayerBase;
472}
473
474table MultiplicationLayer {
475    base:LayerBase;
476}
477
478table Pooling2dLayer {
479    base:LayerBase;
480    descriptor:Pooling2dDescriptor;
481}
482
483table Pooling3dLayer {
484    base:LayerBase;
485    descriptor:Pooling3dDescriptor;
486}
487
488enum PoolingAlgorithm : byte {
489    Max = 0,
490    Average = 1,
491    L2 = 2
492}
493
494enum OutputShapeRounding : byte {
495    Floor = 0,
496    Ceiling = 1
497}
498
499enum PaddingMethod : byte {
500    IgnoreValue = 0,
501    Exclude = 1
502}
503
504table Pooling2dDescriptor {
505    poolType:PoolingAlgorithm;
506    padLeft:uint;
507    padRight:uint;
508    padTop:uint;
509    padBottom:uint;
510    poolWidth:uint;
511    poolHeight:uint;
512    strideX:uint;
513    strideY:uint;
514    outputShapeRounding:OutputShapeRounding;
515    paddingMethod:PaddingMethod;
516    dataLayout:DataLayout;
517}
518
519table Pooling3dDescriptor {
520    poolType:PoolingAlgorithm;
521    padLeft:uint;
522    padRight:uint;
523    padTop:uint;
524    padBottom:uint;
525    padFront:uint;
526    padBack:uint;
527    poolWidth:uint;
528    poolHeight:uint;
529    poolDepth:uint;
530    strideX:uint;
531    strideY:uint;
532    strideZ:uint;
533    outputShapeRounding:OutputShapeRounding;
534    paddingMethod:PaddingMethod;
535    dataLayout:DataLayout;
536}
537
538table QuantizeLayer {
539    base:LayerBase;
540}
541
542table SoftmaxLayer {
543    base:LayerBase;
544    descriptor:SoftmaxDescriptor;
545}
546
547table SoftmaxDescriptor {
548    beta:float;
549    axis:int = -1;
550}
551
552table DepthwiseConvolution2dLayer {
553    base:LayerBase;
554    descriptor:DepthwiseConvolution2dDescriptor;
555    weights:ConstTensor;
556    biases:ConstTensor;
557}
558
559table DepthwiseConvolution2dDescriptor {
560    padLeft:uint;
561    padRight:uint;
562    padTop:uint;
563    padBottom:uint;
564    strideX:uint;
565    strideY:uint;
566    dilationX:uint = 1;
567    dilationY:uint = 1;
568    biasEnabled:bool = false;
569    dataLayout:DataLayout = NCHW;
570}
571
572table OutputLayer {
573    base:BindableLayerBase;
574}
575
576table ReshapeLayer {
577    base:LayerBase;
578    descriptor:ReshapeDescriptor;
579}
580
581table ReshapeDescriptor {
582    targetShape:[uint];
583}
584
585table PermuteLayer {
586    base:LayerBase;
587    descriptor:PermuteDescriptor;
588}
589
590table PermuteDescriptor {
591    dimMappings:[uint];
592}
593
594table ShapeLayer {
595    base:LayerBase;
596}
597
598table SpaceToBatchNdLayer {
599    base:LayerBase;
600    descriptor:SpaceToBatchNdDescriptor;
601}
602
603table SpaceToBatchNdDescriptor {
604    blockShape:[uint];
605    padList:[uint];
606    dataLayout:DataLayout;
607}
608
609table SpaceToDepthLayer {
610    base:LayerBase;
611    descriptor:SpaceToDepthDescriptor;
612}
613
614table SpaceToDepthDescriptor {
615    blockSize:uint;
616    dataLayout:DataLayout;
617}
618
619table SubtractionLayer {
620    base:LayerBase;
621}
622
623table BatchToSpaceNdLayer {
624    base:LayerBase;
625    descriptor:BatchToSpaceNdDescriptor;
626}
627
628table BatchToSpaceNdDescriptor {
629    blockShape:[uint];
630    crops:[uint];
631    dataLayout:DataLayout;
632}
633
634enum NormalizationAlgorithmChannel : byte {
635    Across = 0,
636    Within = 1
637}
638
639enum NormalizationAlgorithmMethod : byte {
640    LocalBrightness = 0,
641    LocalContrast = 1
642}
643
644table NormalizationLayer {
645    base:LayerBase;
646    descriptor:NormalizationDescriptor;
647}
648
649table NormalizationDescriptor {
650    normChannelType:NormalizationAlgorithmChannel = Across;
651    normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
652    normSize:uint;
653    alpha:float;
654    beta:float;
655    k:float;
656    dataLayout:DataLayout = NCHW;
657}
658
659table MeanLayer {
660    base:LayerBase;
661    descriptor:MeanDescriptor;
662}
663
664table MeanDescriptor {
665    axis:[uint];
666    keepDims:bool = false;
667}
668
669table PadLayer {
670    base:LayerBase;
671    descriptor:PadDescriptor;
672}
673
674enum PaddingMode : byte {
675    Constant  = 0,
676    Reflect   = 1,
677    Symmetric = 2
678}
679
680table PadDescriptor {
681    padList:[uint];
682    padValue:float = 0;
683    paddingMode:PaddingMode = Constant;
684}
685
686/// @deprecated Use ElementwiseUnaryLayer instead
687table RsqrtLayer {
688    base:LayerBase;
689}
690
691table BatchNormalizationLayer {
692    base:LayerBase;
693    descriptor:BatchNormalizationDescriptor;
694    mean:ConstTensor;
695    variance:ConstTensor;
696    beta:ConstTensor;
697    gamma:ConstTensor;
698}
699
700table BatchNormalizationDescriptor {
701    eps:float;
702    dataLayout:DataLayout;
703}
704
705/// @deprecated Use ResizeLayer instead
706table ResizeBilinearLayer {
707    base:LayerBase;
708    descriptor:ResizeBilinearDescriptor;
709}
710
711table ResizeBilinearDescriptor {
712    targetWidth:uint;
713    targetHeight:uint;
714    dataLayout:DataLayout;
715    alignCorners:bool;
716    halfPixelCenters:bool;
717}
718
719table SliceLayer {
720    base:LayerBase;
721    descriptor:SliceDescriptor;
722}
723
724table SliceDescriptor {
725    begin:[uint];
726    size:[uint];
727}
728
729table StridedSliceLayer {
730    base:LayerBase;
731    descriptor:StridedSliceDescriptor;
732}
733
734table StridedSliceDescriptor {
735    begin:[int];
736    end:[int];
737    stride:[int];
738    beginMask:int;
739    endMask:int;
740    shrinkAxisMask:int;
741    ellipsisMask:int;
742    newAxisMask:int;
743    dataLayout:DataLayout;
744}
745
746table ConcatLayer {
747    base:LayerBase;
748    descriptor:OriginsDescriptor;
749}
750
751/// @deprecated Use ConcatLayer instead
752table MergerLayer {
753    base:LayerBase;
754    descriptor:OriginsDescriptor;
755}
756
757table UintVector {
758   data:[uint];
759}
760
761table OriginsDescriptor {
762   concatAxis:uint;
763   numViews:uint;
764   numDimensions:uint;
765   viewOrigins:[UintVector];
766}
767
768table ViewsDescriptor {
769   origins:OriginsDescriptor;
770   viewSizes:[UintVector];
771}
772
773table SplitterLayer {
774   base:LayerBase;
775   descriptor:ViewsDescriptor;
776}
777
778table DetectionPostProcessLayer {
779    base:LayerBase;
780    descriptor:DetectionPostProcessDescriptor;
781    anchors:ConstTensor;
782}
783
784table DetectionPostProcessDescriptor {
785    maxDetections:uint;
786    maxClassesPerDetection:uint;
787    detectionsPerClass:uint;
788    nmsScoreThreshold:float;
789    nmsIouThreshold:float;
790    numClasses:uint;
791    useRegularNms:bool;
792    scaleX:float;
793    scaleY:float;
794    scaleW:float;
795    scaleH:float;
796}
797
798table LstmInputParams {
799    inputToForgetWeights:ConstTensor;
800    inputToCellWeights:ConstTensor;
801    inputToOutputWeights:ConstTensor;
802    recurrentToForgetWeights:ConstTensor;
803    recurrentToCellWeights:ConstTensor;
804    recurrentToOutputWeights:ConstTensor;
805    forgetGateBias:ConstTensor;
806    cellBias:ConstTensor;
807    outputGateBias:ConstTensor;
808
809    inputToInputWeights:ConstTensor;
810    recurrentToInputWeights:ConstTensor;
811    cellToInputWeights:ConstTensor;
812    inputGateBias:ConstTensor;
813
814    projectionWeights:ConstTensor;
815    projectionBias:ConstTensor;
816
817    cellToForgetWeights:ConstTensor;
818    cellToOutputWeights:ConstTensor;
819
820    inputLayerNormWeights:ConstTensor;
821    forgetLayerNormWeights:ConstTensor;
822    cellLayerNormWeights:ConstTensor;
823    outputLayerNormWeights:ConstTensor;
824}
825
826table LstmDescriptor {
827    activationFunc:uint;
828    clippingThresCell:float;
829    clippingThresProj:float;
830    cifgEnabled:bool = true;
831    peepholeEnabled:bool = false;
832    projectionEnabled:bool = false;
833    layerNormEnabled:bool = false;
834}
835
836table LstmLayer {
837    base:LayerBase;
838    descriptor:LstmDescriptor;
839    inputParams:LstmInputParams;
840}
841
842table QLstmInputParams {
843    // Mandatory
844    inputToForgetWeights:ConstTensor;
845    inputToCellWeights:ConstTensor;
846    inputToOutputWeights:ConstTensor;
847
848    recurrentToForgetWeights:ConstTensor;
849    recurrentToCellWeights:ConstTensor;
850    recurrentToOutputWeights:ConstTensor;
851
852    forgetGateBias:ConstTensor;
853    cellBias:ConstTensor;
854    outputGateBias:ConstTensor;
855
856    // CIFG
857    inputToInputWeights:ConstTensor;
858    recurrentToInputWeights:ConstTensor;
859    inputGateBias:ConstTensor;
860
861    // Projection
862    projectionWeights:ConstTensor;
863    projectionBias:ConstTensor;
864
865    // Peephole
866    cellToInputWeights:ConstTensor;
867    cellToForgetWeights:ConstTensor;
868    cellToOutputWeights:ConstTensor;
869
870    // Layer norm
871    inputLayerNormWeights:ConstTensor;
872    forgetLayerNormWeights:ConstTensor;
873    cellLayerNormWeights:ConstTensor;
874    outputLayerNormWeights:ConstTensor;
875}
876
877table QLstmDescriptor {
878    cifgEnabled:bool       = true;
879    peepholeEnabled:bool   = false;
880    projectionEnabled:bool = false;
881    layerNormEnabled:bool  = false;
882
883    cellClip:float;
884    projectionClip:float;
885
886    inputIntermediateScale:float;
887    forgetIntermediateScale:float;
888    cellIntermediateScale:float;
889    outputIntermediateScale:float;
890
891    hiddenStateZeroPoint:int;
892    hiddenStateScale:float;
893}
894
895table QLstmLayer {
896    base:LayerBase;
897    descriptor:QLstmDescriptor;
898    inputParams:QLstmInputParams;
899}
900
901table QuantizedLstmInputParams {
902    inputToInputWeights:ConstTensor;
903    inputToForgetWeights:ConstTensor;
904    inputToCellWeights:ConstTensor;
905    inputToOutputWeights:ConstTensor;
906
907    recurrentToInputWeights:ConstTensor;
908    recurrentToForgetWeights:ConstTensor;
909    recurrentToCellWeights:ConstTensor;
910    recurrentToOutputWeights:ConstTensor;
911
912    inputGateBias:ConstTensor;
913    forgetGateBias:ConstTensor;
914    cellBias:ConstTensor;
915    outputGateBias:ConstTensor;
916}
917
918table QuantizedLstmLayer {
919    base:LayerBase;
920    inputParams:QuantizedLstmInputParams;
921}
922
923table DequantizeLayer {
924    base:LayerBase;
925}
926
927table MergeLayer {
928    base:LayerBase;
929}
930
931table SwitchLayer {
932    base:LayerBase;
933}
934
935table PreluLayer {
936    base:LayerBase;
937}
938
939table TransposeConvolution2dLayer {
940    base:LayerBase;
941    descriptor:TransposeConvolution2dDescriptor;
942    weights:ConstTensor;
943    biases:ConstTensor;
944}
945
946table TransposeConvolution2dDescriptor {
947    padLeft:uint;
948    padRight:uint;
949    padTop:uint;
950    padBottom:uint;
951    strideX:uint;
952    strideY:uint;
953    biasEnabled:bool = false;
954    dataLayout:DataLayout = NCHW;
955}
956
957table TransposeLayer {
958    base:LayerBase;
959    descriptor:TransposeDescriptor;
960}
961
962table TransposeDescriptor {
963    dimMappings:[uint];
964}
965
966table ResizeLayer {
967    base:LayerBase;
968    descriptor:ResizeDescriptor;
969}
970
971table ResizeDescriptor {
972    targetHeight:uint;
973    targetWidth:uint;
974    method:ResizeMethod = NearestNeighbor;
975    dataLayout:DataLayout;
976    alignCorners:bool;
977    halfPixelCenters:bool;
978}
979
980table StackLayer {
981    base:LayerBase;
982    descriptor:StackDescriptor;
983}
984
985table StackDescriptor {
986    axis:uint;
987    numInputs:uint;
988    inputShape:[uint];
989}
990
991table StandInDescriptor {
992    numInputs:uint;
993    numOutputs:uint;
994}
995
996table StandInLayer {
997    base:LayerBase;
998    descriptor:StandInDescriptor;
999}
1000
1001table RankLayer {
1002    base:LayerBase;
1003}
1004
1005table ReduceLayer {
1006    base:LayerBase;
1007    descriptor:ReduceDescriptor;
1008}
1009
1010table ReduceDescriptor {
1011    keepDims:bool = false;
1012    axis:[uint];
1013    reduceOperation:ReduceOperation = Sum;
1014}
1015
1016table UnidirectionalSequenceLstmDescriptor {
1017    activationFunc:uint;
1018    clippingThresCell:float;
1019    clippingThresProj:float;
1020    cifgEnabled:bool = true;
1021    peepholeEnabled:bool = false;
1022    projectionEnabled:bool = false;
1023    layerNormEnabled:bool = false;
1024    timeMajor:bool = false;
1025}
1026
1027table UnidirectionalSequenceLstmLayer {
1028    base:LayerBase;
1029    descriptor:UnidirectionalSequenceLstmDescriptor;
1030    inputParams:LstmInputParams;
1031}
1032
1033table BatchMatMulDescriptor {
1034    transposeX:bool = false;
1035    transposeY:bool = false;
1036    adjointX:bool = false;
1037    adjointY:bool = false;
1038    dataLayoutX:DataLayout = NCHW;
1039    dataLayoutY:DataLayout = NCHW;
1040}
1041
1042table BatchMatMulLayer {
1043    base:LayerBase;
1044    descriptor:BatchMatMulDescriptor;
1045}
1046
1047union Layer {
1048    ActivationLayer,
1049    AdditionLayer,
1050    BatchToSpaceNdLayer,
1051    BatchNormalizationLayer,
1052    ConstantLayer,
1053    Convolution2dLayer,
1054    DepthwiseConvolution2dLayer,
1055    FullyConnectedLayer,
1056    InputLayer,
1057    MultiplicationLayer,
1058    OutputLayer,
1059    PermuteLayer,
1060    Pooling2dLayer,
1061    ReshapeLayer,
1062    SoftmaxLayer,
1063    SpaceToBatchNdLayer,
1064    DivisionLayer,
1065    MinimumLayer,
1066    EqualLayer,
1067    MaximumLayer,
1068    NormalizationLayer,
1069    PadLayer,
1070    RsqrtLayer,
1071    FloorLayer,
1072    GreaterLayer,
1073    ResizeBilinearLayer,
1074    SubtractionLayer,
1075    StridedSliceLayer,
1076    GatherLayer,
1077    MeanLayer,
1078    MergerLayer,
1079    L2NormalizationLayer,
1080    SplitterLayer,
1081    DetectionPostProcessLayer,
1082    LstmLayer,
1083    QuantizedLstmLayer,
1084    QuantizeLayer,
1085    DequantizeLayer,
1086    MergeLayer,
1087    SwitchLayer,
1088    ConcatLayer,
1089    SpaceToDepthLayer,
1090    PreluLayer,
1091    TransposeConvolution2dLayer,
1092    ResizeLayer,
1093    StackLayer,
1094    AbsLayer,
1095    ArgMinMaxLayer,
1096    SliceLayer,
1097    DepthToSpaceLayer,
1098    InstanceNormalizationLayer,
1099    LogSoftmaxLayer,
1100    ComparisonLayer,
1101    StandInLayer,
1102    ElementwiseUnaryLayer,
1103    TransposeLayer,
1104    QLstmLayer,
1105    FillLayer,
1106    RankLayer,
1107    LogicalBinaryLayer,
1108    ReduceLayer,
1109    CastLayer,
1110    ShapeLayer,
1111    UnidirectionalSequenceLstmLayer,
1112    ChannelShuffleLayer,
1113    Convolution3dLayer,
1114    Pooling3dLayer,
1115    GatherNdLayer,
1116    BatchMatMulLayer,
1117    ElementwiseBinaryLayer,
1118}
1119
1120table AnyLayer {
1121    layer:Layer;
1122}
1123
1124table FeatureCompatibilityVersions {
1125  bindingIdsScheme:uint = 0;
1126  weightsLayoutScheme:uint = 0;
1127  constantTensorsAsInputs:uint = 0;
1128}
1129
1130// Root type for serialized data is the graph of the network
1131table SerializedGraph {
1132    layers:[AnyLayer];
1133    inputIds:[int];
1134    outputIds:[int];
1135    featureVersions:FeatureCompatibilityVersions;
1136}
1137
1138root_type SerializedGraph;
1139