blob: 5d6388d9445e6acbc7f11640b3ebf586edb2521c [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,
69 Output = 3
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000070}
71
72// Base layer table to be used as part of other layers
73table LayerBase {
74 index:uint;
75 layerName:string;
76 layerType:LayerType;
77 inputSlots:[InputSlot];
78 outputSlots:[OutputSlot];
79}
80
81table BindableLayerBase {
82 base:LayerBase;
83 layerBindingId:int;
84}
85
86// Table for each layer defined below
87table AdditionLayer {
88 base:LayerBase;
89}
90
91table InputLayer {
92 base:BindableLayerBase;
93}
94
Sadik Armagan5f450272019-02-12 14:31:45 +000095table MultiplicationLayer {
96 base:LayerBase;
97}
98
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +000099table OutputLayer {
100 base:BindableLayerBase;
101}
102
103union Layer {
104 AdditionLayer,
105 InputLayer,
Sadik Armagan5f450272019-02-12 14:31:45 +0000106 MultiplicationLayer,
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000107 OutputLayer
108}
109
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000110table AnyLayer {
111 layer:Layer;
112}
113
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000114// Root type for serialized data is the graph of the network
115table SerializedGraph {
Saoirse Stewart49dbe0e2019-02-05 17:27:06 +0000116 layers:[AnyLayer];
Mike Kelly8c1701a2019-02-11 17:01:27 +0000117 inputIds:[uint];
118 outputIds:[uint];
Nattapat Chaimanowong969eea32019-01-30 13:33:11 +0000119}
120
121root_type SerializedGraph;