2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
6 namespace armnnSerializer;
8 file_identifier "ARMN";
10 file_extension "armnn";
12 enum ActivationFunction : byte {
25 enum ArgMinMaxFunction : byte {
30 enum DataType : byte {
39 enum DataLayout : byte {
44 enum ResizeMethod: byte {
52 quantizationScale:float = 1.0;
53 quantizationOffset:int = 0;
57 sourceLayerIndex:uint;
77 union ConstTensorData { ByteData, ShortData, IntData, LongData }
86 connection:Connection;
91 tensorInfo:TensorInfo;
94 enum LayerType : uint {
103 DepthwiseConvolution2d = 8,
118 BatchNormalization = 23,
126 L2Normalization = 31,
128 DetectionPostProcess = 33,
137 TransposeConvolution2d = 42,
145 InstanceNormalization = 50,
151 // Base layer table to be used as part of other layers
156 inputSlots:[InputSlot];
157 outputSlots:[OutputSlot];
160 table BindableLayerBase {
165 // Table for each layer defined below
171 table ActivationLayer {
173 descriptor:ActivationDescriptor;
176 table ActivationDescriptor {
177 activationFunction:ActivationFunction = Sigmoid;
182 table AdditionLayer {
186 table ArgMinMaxLayer {
188 descriptor:ArgMinMaxDescriptor;
191 table ArgMinMaxDescriptor{
192 argMinMaxFunction:ArgMinMaxFunction;
196 enum ComparisonOperation : byte {
205 table ComparisonDescriptor {
206 operation:ComparisonOperation;
209 table ComparisonLayer {
211 descriptor:ComparisonDescriptor;
214 table ConstantLayer {
219 table Convolution2dLayer {
221 descriptor:Convolution2dDescriptor;
226 table Convolution2dDescriptor {
235 biasEnabled:bool = false;
236 dataLayout:DataLayout = NCHW;
239 table DepthToSpaceLayer {
241 descriptor:DepthToSpaceDescriptor;
244 table DepthToSpaceDescriptor {
246 dataLayout:DataLayout;
249 table DivisionLayer {
253 /// @deprecated Use ComparisonLayer instead
262 table FullyConnectedLayer {
264 descriptor:FullyConnectedDescriptor;
269 table FullyConnectedDescriptor {
270 biasEnabled:bool = false;
271 transposeWeightsMatrix:bool = false;
278 /// @deprecated Use ComparisonLayer instead
284 base:BindableLayerBase;
287 table InstanceNormalizationLayer {
289 descriptor:InstanceNormalizationDescriptor;
292 table InstanceNormalizationDescriptor {
296 dataLayout:DataLayout;
299 table LogSoftmaxLayer {
301 descriptor:LogSoftmaxDescriptor;
304 table LogSoftmaxDescriptor {
309 table L2NormalizationLayer {
311 descriptor:L2NormalizationDescriptor;
314 table L2NormalizationDescriptor {
315 dataLayout:DataLayout = NCHW;
327 table MultiplicationLayer {
331 table Pooling2dLayer {
333 descriptor:Pooling2dDescriptor;
336 enum PoolingAlgorithm : byte {
342 enum OutputShapeRounding : byte {
347 enum PaddingMethod : byte {
352 table Pooling2dDescriptor {
353 poolType:PoolingAlgorithm;
362 outputShapeRounding:OutputShapeRounding;
363 paddingMethod:PaddingMethod;
364 dataLayout:DataLayout;
367 table QuantizeLayer {
373 descriptor:SoftmaxDescriptor;
376 table SoftmaxDescriptor {
380 table DepthwiseConvolution2dLayer {
382 descriptor:DepthwiseConvolution2dDescriptor;
387 table DepthwiseConvolution2dDescriptor {
396 biasEnabled:bool = false;
397 dataLayout:DataLayout = NCHW;
401 base:BindableLayerBase;
406 descriptor:ReshapeDescriptor;
409 table ReshapeDescriptor {
415 descriptor:PermuteDescriptor;
418 table PermuteDescriptor {
422 table SpaceToBatchNdLayer {
424 descriptor:SpaceToBatchNdDescriptor;
427 table SpaceToBatchNdDescriptor {
430 dataLayout:DataLayout;
433 table SpaceToDepthLayer {
435 descriptor:SpaceToDepthDescriptor;
438 table SpaceToDepthDescriptor {
440 dataLayout:DataLayout;
443 table SubtractionLayer {
447 table BatchToSpaceNdLayer {
449 descriptor:BatchToSpaceNdDescriptor;
452 table BatchToSpaceNdDescriptor {
455 dataLayout:DataLayout;
458 enum NormalizationAlgorithmChannel : byte {
463 enum NormalizationAlgorithmMethod : byte {
468 table NormalizationLayer {
470 descriptor:NormalizationDescriptor;
473 table NormalizationDescriptor {
474 normChannelType:NormalizationAlgorithmChannel = Across;
475 normMethodType:NormalizationAlgorithmMethod = LocalBrightness;
480 dataLayout:DataLayout = NCHW;
485 descriptor:MeanDescriptor;
488 table MeanDescriptor {
490 keepDims:bool = false;
495 descriptor:PadDescriptor;
498 table PadDescriptor {
507 table BatchNormalizationLayer {
509 descriptor:BatchNormalizationDescriptor;
511 variance:ConstTensor;
516 table BatchNormalizationDescriptor {
518 dataLayout:DataLayout;
521 /// @deprecated Use ResizeLayer instead
522 table ResizeBilinearLayer {
524 descriptor:ResizeBilinearDescriptor;
527 table ResizeBilinearDescriptor {
530 dataLayout:DataLayout;
535 descriptor:SliceDescriptor;
538 table SliceDescriptor {
543 table StridedSliceLayer {
545 descriptor:StridedSliceDescriptor;
548 table StridedSliceDescriptor {
557 dataLayout:DataLayout;
562 descriptor:OriginsDescriptor;
565 /// @deprecated Use ConcatLayer instead
568 descriptor:OriginsDescriptor;
575 table OriginsDescriptor {
579 viewOrigins:[UintVector];
582 table ViewsDescriptor {
583 origins:OriginsDescriptor;
584 viewSizes:[UintVector];
587 table SplitterLayer {
589 descriptor:ViewsDescriptor;
592 table DetectionPostProcessLayer {
594 descriptor:DetectionPostProcessDescriptor;
598 table DetectionPostProcessDescriptor {
600 maxClassesPerDetection:uint;
601 detectionsPerClass:uint;
602 nmsScoreThreshold:float;
603 nmsIouThreshold:float;
612 table LstmInputParams {
613 inputToForgetWeights:ConstTensor;
614 inputToCellWeights:ConstTensor;
615 inputToOutputWeights:ConstTensor;
616 recurrentToForgetWeights:ConstTensor;
617 recurrentToCellWeights:ConstTensor;
618 recurrentToOutputWeights:ConstTensor;
619 forgetGateBias:ConstTensor;
620 cellBias:ConstTensor;
621 outputGateBias:ConstTensor;
623 inputToInputWeights:ConstTensor;
624 recurrentToInputWeights:ConstTensor;
625 cellToInputWeights:ConstTensor;
626 inputGateBias:ConstTensor;
628 projectionWeights:ConstTensor;
629 projectionBias:ConstTensor;
631 cellToForgetWeights:ConstTensor;
632 cellToOutputWeights:ConstTensor;
634 inputLayerNormWeights:ConstTensor;
635 forgetLayerNormWeights:ConstTensor;
636 cellLayerNormWeights:ConstTensor;
637 outputLayerNormWeights:ConstTensor;
640 table QuantizedLstmInputParams {
641 inputToInputWeights:ConstTensor;
642 inputToForgetWeights:ConstTensor;
643 inputToCellWeights:ConstTensor;
644 inputToOutputWeights:ConstTensor;
646 recurrentToInputWeights:ConstTensor;
647 recurrentToForgetWeights:ConstTensor;
648 recurrentToCellWeights:ConstTensor;
649 recurrentToOutputWeights:ConstTensor;
651 inputGateBias:ConstTensor;
652 forgetGateBias:ConstTensor;
653 cellBias:ConstTensor;
654 outputGateBias:ConstTensor;
657 table LstmDescriptor {
659 clippingThresCell:float;
660 clippingThresProj:float;
661 cifgEnabled:bool = true;
662 peepholeEnabled:bool = false;
663 projectionEnabled:bool = false;
664 layerNormEnabled:bool = false;
669 descriptor:LstmDescriptor;
670 inputParams:LstmInputParams;
673 table QuantizedLstmLayer {
675 inputParams:QuantizedLstmInputParams;
678 table DequantizeLayer {
694 table TransposeConvolution2dLayer {
696 descriptor:TransposeConvolution2dDescriptor;
701 table TransposeConvolution2dDescriptor {
708 biasEnabled:bool = false;
709 dataLayout:DataLayout = NCHW;
714 descriptor:ResizeDescriptor;
717 table ResizeDescriptor {
720 method:ResizeMethod = NearestNeighbor;
721 dataLayout:DataLayout;
726 descriptor:StackDescriptor;
729 table StackDescriptor {
735 table StandInDescriptor {
742 descriptor:StandInDescriptor;
749 BatchNormalizationLayer,
752 DepthwiseConvolution2dLayer,
777 L2NormalizationLayer,
779 DetectionPostProcessLayer,
789 TransposeConvolution2dLayer,
796 InstanceNormalizationLayer,
806 // Root type for serialized data is the graph of the network
807 table SerializedGraph {
813 root_type SerializedGraph;