summaryrefslogtreecommitdiff
path: root/compiler/circlechef/proto/circlechef.proto
blob: b8c009b389abd8299b6305c6e54a2c81f78aeb39 (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
syntax = "proto2";

package circlechef;

//
// Initial version
//  - Our initial version
//
// Version 1
//  - Backward compatible with Initial version
//  - Added Graph to represent sub graphs
//  - Added name, version(default as 1), graph in ModelRecipe
//

// This enum value corresponds to TensorType in TensorFlow Lite schema
enum TensorType {
  FLOAT32 = 0;
  INT32 = 2;
  UINT8 = 3;
  INT64 = 4;
  BOOL = 6;
}

message TensorShape {
  repeated uint32 dim = 3;
}

message TensorFiller {
  optional string tag = 1;
  repeated string arg = 2;
}

message TensorQuantization {
  repeated float min = 1;
  repeated float max = 2;
  repeated float scale = 3;
  repeated int64 zero_point = 4;
}

message Operand {
  optional string name = 1;
  optional TensorType type = 2;
  optional TensorShape shape = 3;
  optional TensorFiller filler = 4;
  optional TensorQuantization quant = 5;
}

// This enum value corresponds to Padding in TensorFlow Lite schema
enum Padding {
  SAME = 0;
  VALID = 1;
}

// This enum value corresponds to ActivationFunctionType in TensorFlow Lite schema
enum Activation {
  NONE = 0;
  RELU = 1;
  RELU6 = 3;
}

message BatchMatMulOptions {
  optional bool adjoint_lhs = 1 [default = false];
  optional bool adjoint_rhs = 2 [default = false];
}

message InstanceNormOptions {
  optional float epsilon = 1 [default = 1e-05];
  optional Activation activation = 2 [default = NONE];
}

message BCQFullyConnectedOptions {
  optional int32 weights_hidden_size = 1 [default = 0];
  optional Activation activation = 2 [default = NONE];
}

message BCQGatherOptions {
  optional int32 input_hidden_size = 1 [default = 0];
  optional int32 axis = 2 [default = 0];
}

message Operation {
  optional string type = 1;
  repeated string input = 2;
  repeated string output = 3;
  optional int32 version = 4 [default = 1];

  optional BatchMatMulOptions batch_matmul_options = 100;
  optional InstanceNormOptions instance_norm_options = 101;
  optional BCQFullyConnectedOptions bcq_fully_connected_options = 102;
  optional BCQGatherOptions bcq_gather_options = 103;
}

// For additional subgraphs
message Graph {
  repeated Operand operand = 1;
  repeated Operation operation = 2;
  repeated string input = 3;
  repeated string output = 4;
  optional string name = 5;
}

message ModelRecipe {
  repeated Operand operand = 1;
  repeated Operation operation = 2;
  repeated string input = 3;
  repeated string output = 4;
  optional string name = 5;
  optional uint32 version = 6 [default = 1];
  repeated Graph graph = 7;
}