diff options
Diffstat (limited to 'compiler/tflchef/proto/tflchef.proto')
-rw-r--r-- | compiler/tflchef/proto/tflchef.proto | 232 |
1 files changed, 232 insertions, 0 deletions
diff --git a/compiler/tflchef/proto/tflchef.proto b/compiler/tflchef/proto/tflchef.proto new file mode 100644 index 000000000..486aa8a67 --- /dev/null +++ b/compiler/tflchef/proto/tflchef.proto @@ -0,0 +1,232 @@ +syntax = "proto2"; + +package tflchef; + +// +// 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 Conv2DOptions +{ + optional Padding padding = 1 [default = VALID]; + optional int32 stride_w = 2 [default = 1]; + optional int32 stride_h = 3 [default = 1]; + optional Activation activation = 4 [default = NONE]; +} + +message Pool2DOptions { + optional Padding padding = 1 [default = VALID]; + optional int32 stride_w = 2 [default = 1]; + optional int32 stride_h = 3 [default = 1]; + optional int32 filter_width = 4 [default = 1]; + optional int32 filter_height = 5 [ default = 1]; + optional Activation activation = 6 [default = NONE]; +} + +message ConcatenationOptions { + optional int32 axis = 1 [default = 0]; + optional Activation activation = 2 [default = NONE]; +} + +message ReshapeOptions { + repeated int32 new_shape = 1; +} + +message DepthwiseConv2DOptions +{ + optional Padding padding = 1 [default = VALID]; + optional int32 stride_w = 2 [default = 1]; + optional int32 stride_h = 3 [default = 1]; + optional int32 depth_multiplier = 4 [default = 1]; + optional Activation activation = 5 [default = NONE]; +} + +message SubOptions { + optional Activation activation = 1 [default = NONE]; +} + +message DivOptions { + optional Activation activation = 1 [default = NONE]; +} + +message FloorDivOptions { + // None +} + +message FullyConnectedOptions { + optional Activation activation = 1 [default = NONE]; +} + +message AddOptions { + optional Activation activation = 1 [default = NONE]; +} + +message ArgMaxOptions { + optional TensorType output_type = 1 [default = INT64]; +} + +message PackOptions { + optional int32 values_count = 1; + optional int32 axis = 2 [default = 0]; +} + +message PadOptions { + // None +} + +message SoftmaxOptions { + optional float beta = 1 [default = 0.0]; +} + +message MulOptions { + optional Activation activation = 1 [default = NONE]; +} + +message ReducerOptions { + optional bool keep_dims = 1 [ default = false ]; +} + +message LogicalOrOptions { + // None +} + +message LogicalNotOptions { + // None +} + +message LogicalAndOptions { + // None +} + +message TransposeOptions { + // None +} + +message AbsOptions { + // None +} + +message CosOptions { + // None +} + +message EqualOptions { + // None +} + +message ShapeOptions { + optional TensorType out_type = 1 [default = INT32]; +} + +message BatchToSpaceNDOptions { + // None +} + +message ExpOptions { + // None +} + +message Operation { + optional string type = 1; + repeated string input = 2; + repeated string output = 3; + + optional Conv2DOptions conv2d_options = 100; + optional Pool2DOptions averagepool2d_options = 101; + optional ConcatenationOptions concatenation_options = 102; + optional Pool2DOptions maxpool2d_options = 103; + optional ReshapeOptions reshape_options = 104; + optional DepthwiseConv2DOptions depthwiseconv2d_options = 105; + optional SubOptions sub_options = 106; + optional DivOptions div_options = 107; + optional FullyConnectedOptions fullyconnected_options = 108; + optional AddOptions add_options = 109; + optional ArgMaxOptions argmax_options = 110; + optional PadOptions pad_options = 111; + optional SoftmaxOptions softmax_options = 112; + optional MulOptions mul_options = 113; + optional ReducerOptions mean_options = 114; + optional TransposeOptions transpose_options = 115; + optional PackOptions pack_options = 116; + optional LogicalOrOptions logical_or_options = 117; + optional LogicalNotOptions logical_not_options = 118; + optional LogicalAndOptions logical_and_options = 119; + optional AbsOptions abs_options = 120; + optional CosOptions cos_options = 121; + optional EqualOptions equal_options = 122; + optional ShapeOptions shape_options = 123; + optional FloorDivOptions floordiv_options = 124; + optional BatchToSpaceNDOptions batch_to_space_options = 125; + optional ExpOptions exp_options = 126; +} + +// 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; +} |