blob: 411b89ad8ea572de775e3775e1217683cb8f96fd [file] [log] [blame]
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6namespace armnn.armnnSerializer;
7
8file_identifier "ARMN";
9
10file_extension "armnn";
11
12enum DataType : byte {
13 Float16 = 0,
14 Float32 = 1,
15 QuantisedAsymm8 = 2,
16 Signed32 = 3,
17 Boolean = 4
18}
19
20table TensorInfo {
21 dimensions:[uint];
22 dataType:DataType;
23 quantizationScale:float = 1.0;
24 quantizationOffset:int = 0;
25}
26
27struct Connection {
28 sourceLayerIndex:uint;
29 outputSlotIndex:uint;
30}
31
32table ByteData {
33 data:[byte];
34}
35
36table ShortData {
37 data:[short];
38}
39
40table IntData {
41 data:[int];
42}
43
44table LongData {
45 data:[long];
46}
47
48union ConstTensorData { ByteData, ShortData, IntData, LongData }
49
50table ConstTensor {
51 info:TensorInfo;
52 data:ConstTensorData;
53}
54
55table InputSlot {
56 index:uint;
57 connection:Connection;
58}
59
60table OutputSlot {
61 index:uint;
62 tensorInfo:TensorInfo;
63}
64
65enum LayerType : uint {
66 Addition = 0,
67 Input = 1,
Sadik Armagan5f450272019-02-12 14:31:45 +000068 Multiplication = 2,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +000069 Output = 3,
70 Softmax = 4
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000071}
72
73// Base layer table to be used as part of other layers
74table LayerBase {
75 index:uint;
76 layerName:string;
77 layerType:LayerType;
78 inputSlots:[InputSlot];
79 outputSlots:[OutputSlot];
80}
81
82table BindableLayerBase {
83 base:LayerBase;
84 layerBindingId:int;
85}
86
87// Table for each layer defined below
88table AdditionLayer {
89 base:LayerBase;
90}
91
92table InputLayer {
93 base:BindableLayerBase;
94}
95
Sadik Armagan5f450272019-02-12 14:31:45 +000096table MultiplicationLayer {
97 base:LayerBase;
98}
99
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000100table SoftmaxLayer {
101 base:LayerBase;
102 descriptor:SoftmaxDescriptor;
103}
104
105table SoftmaxDescriptor {
106 beta:float;
107}
108
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000109table OutputLayer {
110 base:BindableLayerBase;
111}
112
113union Layer {
114 AdditionLayer,
115 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +0000116 MultiplicationLayer,
Aron Virginas-Tarfc413c02019-02-13 15:41:52 +0000117 OutputLayer,
118 SoftmaxLayer
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000119}
120
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000121table AnyLayer {
122 layer:Layer;
123}
124
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000125// Root type for serialized data is the graph of the network
126table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000127 layers:[AnyLayer];
Mike Kelly8c1701a2019-02-11 17:01:27 +0000128 inputIds:[uint];
129 outputIds:[uint];
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000130}
131
132root_type SerializedGraph;