aboutsummaryrefslogtreecommitdiff
path: root/src/armnnSerializer/Schema.fbs
blob: 2527f6d0f604fbc66df7966d0ffddd7b55633725 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

namespace armnn.armnnSerializer;

file_identifier "ARMN";

file_extension "armnn";

enum DataType : byte {
    Float16 = 0,
    Float32 = 1,
    QuantisedAsymm8 = 2,
    Signed32 = 3,
    Boolean = 4
}

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,
    Output = 2
}

// 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 AdditionLayer {
    base:LayerBase;
}

table InputLayer {
    base:BindableLayerBase;
}

table OutputLayer {
    base:BindableLayerBase;
}

union Layer {
    AdditionLayer,
    InputLayer,
    OutputLayer
}

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;