aboutsummaryrefslogtreecommitdiff
path: root/src/armnnSerializer/ArmnnSchema.fbs
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnnSerializer/ArmnnSchema.fbs')
-rw-r--r--src/armnnSerializer/ArmnnSchema.fbs277
1 files changed, 277 insertions, 0 deletions
diff --git a/src/armnnSerializer/ArmnnSchema.fbs b/src/armnnSerializer/ArmnnSchema.fbs
new file mode 100644
index 0000000000..dc14069798
--- /dev/null
+++ b/src/armnnSerializer/ArmnnSchema.fbs
@@ -0,0 +1,277 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+namespace armnnSerializer;
+
+file_identifier "ARMN";
+
+file_extension "armnn";
+
+enum ActivationFunction : byte {
+ Sigmoid = 0,
+ TanH = 1,
+ Linear = 2,
+ ReLu = 3,
+ BoundedReLu = 4,
+ SoftReLu = 5,
+ LeakyReLu = 6,
+ Abs = 7,
+ Sqrt = 8,
+ Square = 9
+}
+
+enum DataType : byte {
+ Float16 = 0,
+ Float32 = 1,
+ QuantisedAsymm8 = 2,
+ Signed32 = 3,
+ Boolean = 4
+}
+
+enum DataLayout : byte {
+ NHWC = 0,
+ NCHW = 1
+}
+
+table TensorInfo {
+ dimensions:[uint];
+ dataType:DataType;
+ quantizationScale:float = 1.0;
+ quantizationOffset:int = 0;
+}
+
+struct Connection {
+ sourceLayerIndex:uint;
+ outputSlotIndex:uint;
+}
+
+table ByteData {
+ data:[byte];
+}
+
+table ShortData {
+ data:[short];
+}
+
+table IntData {
+ data:[int];
+}
+
+table LongData {
+ data:[long];
+}
+
+union ConstTensorData { ByteData, ShortData, IntData, LongData }
+
+table ConstTensor {
+ info:TensorInfo;
+ data:ConstTensorData;
+}
+
+table InputSlot {
+ index:uint;
+ connection:Connection;
+}
+
+table OutputSlot {
+ index:uint;
+ tensorInfo:TensorInfo;
+}
+
+enum LayerType : uint {
+ Addition = 0,
+ Input = 1,
+ Multiplication = 2,
+ Output = 3,
+ Pooling2d = 4,
+ Reshape = 5,
+ Softmax = 6,
+ Convolution2d = 7,
+ DepthwiseConvolution2d = 8,
+ Activation = 9,
+ Permute = 10,
+ FullyConnected = 11
+}
+
+// Base layer table to be used as part of other layers
+table LayerBase {
+ index:uint;
+ layerName:string;
+ layerType:LayerType;
+ inputSlots:[InputSlot];
+ outputSlots:[OutputSlot];
+}
+
+table BindableLayerBase {
+ base:LayerBase;
+ layerBindingId:int;
+}
+
+// Table for each layer defined below
+table ActivationLayer {
+ base:LayerBase;
+ descriptor:ActivationDescriptor;
+}
+
+table ActivationDescriptor {
+ function:ActivationFunction = Sigmoid;
+ a:float;
+ b:float;
+}
+
+table AdditionLayer {
+ base:LayerBase;
+}
+
+table Convolution2dLayer {
+ base:LayerBase;
+ descriptor:Convolution2dDescriptor;
+ weights:ConstTensor;
+ biases:ConstTensor;
+}
+
+table Convolution2dDescriptor {
+ padLeft:uint;
+ padRight:uint;
+ padTop:uint;
+ padBottom:uint;
+ strideX:uint;
+ strideY:uint;
+ biasEnabled:bool = false;
+ dataLayout:DataLayout = NCHW;
+}
+
+table FullyConnectedLayer {
+ base:LayerBase;
+ descriptor:FullyConnectedDescriptor;
+ weights:ConstTensor;
+ biases:ConstTensor;
+}
+
+table FullyConnectedDescriptor {
+ biasEnabled:bool = false;
+ transposeWeightsMatrix:bool = false;
+}
+
+table InputLayer {
+ base:BindableLayerBase;
+}
+
+table MultiplicationLayer {
+ base:LayerBase;
+}
+
+table Pooling2dLayer {
+ base:LayerBase;
+ descriptor:Pooling2dDescriptor;
+}
+
+enum PoolingAlgorithm : byte {
+ Max = 0,
+ Average = 1,
+ L2 = 2
+}
+
+enum OutputShapeRounding : byte {
+ Floor = 0,
+ Ceiling = 1
+}
+
+enum PaddingMethod : byte {
+ IgnoreValue = 0,
+ Exclude = 1
+}
+
+table Pooling2dDescriptor {
+ poolType:PoolingAlgorithm;
+ padLeft:uint;
+ padRight:uint;
+ padTop:uint;
+ padBottom:uint;
+ poolWidth:uint;
+ poolHeight:uint;
+ strideX:uint;
+ strideY:uint;
+ outputShapeRounding:OutputShapeRounding;
+ paddingMethod:PaddingMethod;
+ dataLayout:DataLayout;
+}
+
+table SoftmaxLayer {
+ base:LayerBase;
+ descriptor:SoftmaxDescriptor;
+}
+
+table SoftmaxDescriptor {
+ beta:float;
+}
+
+table DepthwiseConvolution2dLayer {
+ base:LayerBase;
+ descriptor:DepthwiseConvolution2dDescriptor;
+ weights:ConstTensor;
+ biases:ConstTensor;
+}
+
+table DepthwiseConvolution2dDescriptor {
+ padLeft:uint;
+ padRight:uint;
+ padTop:uint;
+ padBottom:uint;
+ strideX:uint;
+ strideY:uint;
+ biasEnabled:bool = false;
+ dataLayout:DataLayout = NCHW;
+}
+
+table OutputLayer {
+ base:BindableLayerBase;
+}
+
+table ReshapeLayer {
+ base:LayerBase;
+ descriptor:ReshapeDescriptor;
+}
+
+table ReshapeDescriptor {
+ targetShape:[uint];
+}
+
+table PermuteLayer {
+ base:LayerBase;
+ descriptor:PermuteDescriptor;
+}
+
+table PermuteDescriptor {
+ dimMappings:[uint];
+}
+
+union Layer {
+ ActivationLayer,
+ AdditionLayer,
+ Convolution2dLayer,
+ DepthwiseConvolution2dLayer,
+ FullyConnectedLayer,
+ InputLayer,
+ MultiplicationLayer,
+ OutputLayer,
+ PermuteLayer,
+ Pooling2dLayer,
+ ReshapeLayer,
+ SoftmaxLayer
+}
+
+table AnyLayer {
+ layer:Layer;
+}
+
+// Root type for serialized data is the graph of the network
+table SerializedGraph {
+ layers:[AnyLayer];
+ inputIds:[uint];
+ outputIds:[uint];
+}
+
+root_type SerializedGraph;