Imported Upstream version 1.8.0
[platform/core/ml/nnfw.git] / compiler / circlechef / proto / circlechef.proto
1 syntax = "proto2";
2
3 package circlechef;
4
5 //
6 // Initial version
7 //  - Our initial version
8 //
9 // Version 1
10 //  - Backward compatible with Initial version
11 //  - Added Graph to represent sub graphs
12 //  - Added name, version(default as 1), graph in ModelRecipe
13 //
14
15 // This enum value corresponds to TensorType in TensorFlow Lite schema
16 enum TensorType {
17   FLOAT32 = 0;
18   INT32 = 2;
19   UINT8 = 3;
20   INT64 = 4;
21   BOOL = 6;
22 }
23
24 message TensorShape {
25   repeated uint32 dim = 3;
26 }
27
28 message TensorFiller {
29   optional string tag = 1;
30   repeated string arg = 2;
31 }
32
33 message TensorQuantization {
34   repeated float min = 1;
35   repeated float max = 2;
36   repeated float scale = 3;
37   repeated int64 zero_point = 4;
38   optional int32 quantized_dimension = 5 [default = 0];
39 }
40
41 message Operand {
42   optional string name = 1;
43   optional TensorType type = 2;
44   optional TensorShape shape = 3;
45   optional TensorFiller filler = 4;
46   optional TensorQuantization quant = 5;
47 }
48
49 // This enum value corresponds to Padding in TensorFlow Lite schema
50 enum Padding {
51   SAME = 0;
52   VALID = 1;
53 }
54
55 // This enum value corresponds to ActivationFunctionType in TensorFlow Lite schema
56 enum Activation {
57   NONE = 0;
58   RELU = 1;
59   RELU6 = 3;
60 }
61
62 message BatchMatMulOptions {
63   optional bool adjoint_lhs = 1 [default = false];
64   optional bool adjoint_rhs = 2 [default = false];
65 }
66
67 message InstanceNormOptions {
68   optional float epsilon = 1 [default = 1e-05];
69   optional Activation activation = 2 [default = NONE];
70 }
71
72 message BCQFullyConnectedOptions {
73   optional int32 weights_hidden_size = 1 [default = 0];
74   optional Activation activation = 2 [default = NONE];
75 }
76
77 message BCQGatherOptions {
78   optional int32 input_hidden_size = 1 [default = 0];
79   optional int32 axis = 2 [default = 0];
80 }
81
82 message Operation {
83   optional string type = 1;
84   repeated string input = 2;
85   repeated string output = 3;
86   optional int32 version = 4 [default = 1];
87
88   optional BatchMatMulOptions batch_matmul_options = 100;
89   optional InstanceNormOptions instance_norm_options = 101;
90   optional BCQFullyConnectedOptions bcq_fully_connected_options = 102;
91   optional BCQGatherOptions bcq_gather_options = 103;
92 }
93
94 // For additional subgraphs
95 message Graph {
96   repeated Operand operand = 1;
97   repeated Operation operation = 2;
98   repeated string input = 3;
99   repeated string output = 4;
100   optional string name = 5;
101 }
102
103 message ModelRecipe {
104   repeated Operand operand = 1;
105   repeated Operation operation = 2;
106   repeated string input = 3;
107   repeated string output = 4;
108   optional string name = 5;
109   optional uint32 version = 6 [default = 1];
110   repeated Graph graph = 7;
111 }