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; FLOAT16 = 1; INT32 = 2; UINT8 = 3; INT64 = 4; STRING = 5; BOOL = 6; INT16 = 7; } enum DimensionType { DENSE = 0; SPARSE_CSR = 1; } enum SparseIndexVecType { SparseIdxVecType_NONE = 0; INT32VEC = 1; UINT16VEC = 2; UINT8VEC = 3; } message TensorShape { repeated uint32 dim = 3; } message ShapeSignature { repeated int32 dim = 1; } 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; optional int32 quantized_dimension = 5 [default = 0]; } message TensorSparsity { message TraversalOrder { repeated int32 dim = 1; } message BlockMap { repeated int32 dim = 1; } message IndexVec { repeated int32 dim = 1; optional SparseIndexVecType type = 2; } message DimMetaData { optional DimensionType format = 1; optional int32 dense_size = 2; optional IndexVec array_segments = 3; optional IndexVec array_indices = 4; } optional TraversalOrder traversal_order = 1; optional BlockMap block_map = 2; repeated DimMetaData dim_metadata = 3; } message Operand { optional string name = 1; optional TensorType type = 2; optional TensorShape shape = 3; optional TensorFiller filler = 4; optional TensorQuantization quant = 5; optional TensorSparsity sparsity = 6; optional bool is_variable = 7 [default = false]; optional ShapeSignature shape_signature = 8; // 'make_sparse' is to tell tflchef to make a sparse tensor // as filling 'TensorSparsity' by hand can be difficult // for now, last dimension will be SPARSE_CSR // ex) shape [2, 3, 4] will have // TraversalOrder [0, 1, 2] with [DENSE, DENSE, SPARSE_CSR] optional bool make_sparse = 9 [default = false]; } // 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; RELU_N1_TO_1 = 2; RELU6 = 3; TANH = 4; SIGN_BIT = 5; } // This enum value corresponds to MirrorPadMode in TensorFlow Lite schema enum MirrorPadMode { REFLECT = 0; SYMMETRIC = 1; } message BidirectionalSequenceLSTMOptions { optional Activation activation = 1 [default = NONE]; optional float cell_clip = 2 [default = 0.0]; optional float proj_clip = 3 [default = 0.0]; optional bool merge_outputs = 6 [default = false]; optional bool time_major = 4 [default = true]; optional bool asymmetric_quantize_inputs = 5 [default = false]; } 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]; optional int32 dilation_w_factor = 5 [default = 1]; optional int32 dilation_h_factor = 6 [default = 1]; } 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]; optional int32 dilation_w_factor = 6 [default = 1]; optional int32 dilation_h_factor = 7 [default = 1]; } message ScatterNdOptions { // None } message SubOptions { optional Activation activation = 1 [default = NONE]; } message DivOptions { optional Activation activation = 1 [default = NONE]; } message FloorDivOptions { // None } message FloorModOptions { // None } message FullyConnectedOptions { optional Activation activation = 1 [default = NONE]; optional bool keep_num_dims = 2 [ default = false ]; } message AddOptions { optional Activation activation = 1 [default = NONE]; } message AddNOptions { // None } message ArgMaxOptions { optional TensorType output_type = 1 [default = INT64]; } message ArgMinOptions { optional TensorType output_type = 1 [default = INT64]; } message PackOptions { optional int32 values_count = 1; optional int32 axis = 2 [default = 0]; } message PadOptions { // None } message PadV2Options { // None } message MirrorPadOptions { optional MirrorPadMode mode = 1 [default = REFLECT]; } message SoftmaxOptions { optional float beta = 1 [default = 0.0]; } message MulOptions { optional Activation activation = 1 [default = NONE]; } message NegOptions { // None } message RangeOptions { // None } message ReducerOptions { optional bool keep_dims = 1 [ default = false ]; } message SpaceToDepthOptions { optional int32 block_size = 1; } 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 SpaceToBatchNDOptions { // None } message StridedSliceOptions { optional int32 begin_mask = 1; optional int32 end_mask = 2; optional int32 ellipsis_mask = 3; optional int32 new_axis_mask = 4; optional int32 shrink_axis_mask = 5; } message SliceOptions { // None } message ExpOptions { // None } message ExpandDimsOptions { // None } message UnpackOptions { optional int32 num = 1; optional int32 axis = 2 [default = 0]; } message GatherOptions { optional int32 axis = 1 [default = 0]; } message TileOptions { // None } message BatchMatMulOptions { optional bool adj_x = 1 [default = false]; optional bool adj_y = 2 [default = false]; } message IfOptions { optional int32 then_subgraph_index = 1; optional int32 else_subgraph_index = 2; } message WhileOptions { optional int32 cond_subgraph_index = 1; optional int32 body_subgraph_index = 2; } message CastOptions { optional TensorType in_data_type = 1 [default = FLOAT32]; optional TensorType out_data_type = 2 [default = FLOAT32]; } message SquareOptions { // None } message MaximumMinimumOptions { //None } message GreaterEqualOptions { // None } message SelectOptions { // None } message SelectV2Options { // None } message SplitOptions { optional int32 num_splits = 1; } message SplitVOptions { optional int32 num_splits = 1; } message SquaredDifferenceOptions { // None } message SVDFOptions { optional int32 rank = 1 [default = 0]; optional Activation activation = 2 [default = NONE]; optional bool asymmetric_quantize_inputs = 3 [default = false]; } message FillOptions { // None } message GreaterOptions { // None } message L2NormOptions { optional Activation activation = 1 [default = NONE]; } message LessOptions { // None } message LessEqualOptions { // None } message LocalResponseNormalizationOptions { optional int32 radius = 1 [default = 5]; optional float bias = 2 [default = 1.0]; optional float alpha = 3 [default = 1.0]; optional float beta = 4 [default = 0.5]; } message MatMulOptions { optional bool transpose_a = 1 [default = false]; optional bool transpose_b = 2 [default = false]; } message SqueezeOptions { repeated int32 squeeze_dim = 1; } message OneHotOptions { optional int32 axis = 1 [default = -1]; } message TopKV2Options { // None } message LogSoftmaxOptions { // None } message ZerosLikeOptions { // None } message GatherNdOptions { // None } message NonMaxSuppressionV4Options { // None } message NonMaxSuppressionV5Options { // None } message NotEqualOptions { // None } message PowOptions { // None } message LeakyReluOptions { optional float alpha = 1 [default = 0.2]; } message ResizeNearestNeighborOptions { optional bool align_corners = 1 [default = false]; } message ResizeBilinearOptions { optional bool align_corners = 1 [default = false]; optional bool half_pixel_centers = 2 [default = false]; } message DepthToSpaceOptions { optional int32 block_size = 1; } message TransposeConvOptions { optional Padding padding = 1 [default = VALID]; optional int32 stride_w = 2 [default = 1]; optional int32 stride_h = 3 [default = 1]; } message ReverseSequenceOptions { optional int32 seq_dim = 1 [default = 0]; optional int32 batch_dim = 2 [default = 0]; } message RankOptions { // NONE } message SegmentSumOptions { // NONE } message UnidirectionalSequenceLSTMOptions { optional Activation activation = 1 [default = NONE]; optional float cell_clip = 2 [default = 0.0]; optional float proj_clip = 3 [default = 0.0]; optional bool time_major = 4 [default = false]; optional bool asymmetric_quantize_inputs = 5 [default = false]; } message UniqueOptions { optional TensorType idx_out_type = 1 [default = INT32]; } message WhereOptions { // None } message SparseToDenseOptions { optional bool validate_indices = 1 [default = true]; } message ReverseV2Options { // None } message MatrixDiagOptions { // NONE } message MatrixSetDiagOptions { // NONE } message DequantizeOptions { // NONE } message MaxPoolWithArgmaxOptions { 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 TensorType output_type = 6 [default = INT64]; optional bool include_batch_in_index = 7 [default = false]; } message FakeQuantOptions { optional float min = 1 [default = 0.0]; optional float max = 2 [default = 0.0]; optional int32 num_bits = 3 [default = 0]; optional bool narrow_range = 4 [default = false]; } message DensifyOptions { // NONE } message Operation { optional string type = 1; repeated string input = 2; repeated string output = 3; optional int32 version = 4 [default = 1]; 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; optional UnpackOptions unpack_options = 127; optional GatherOptions gather_options = 128; optional BatchMatMulOptions batch_matmul_options = 129; optional TileOptions tile_options = 130; optional IfOptions if_options = 131; optional WhileOptions while_options = 132; optional SpaceToBatchNDOptions space_to_batch_nd_options = 133; optional CastOptions cast_options = 134; optional GreaterEqualOptions greaterequal_options = 135; optional MaximumMinimumOptions maximum_options = 136; optional StridedSliceOptions strided_slice_options = 137; optional SquaredDifferenceOptions squared_difference_options = 138; optional FillOptions fill_options = 139; optional SelectOptions select_options = 140; optional ReducerOptions reduce_prod_options = 141; optional SplitOptions split_options = 142; optional SplitVOptions split_v_options = 143; optional ReducerOptions sum_options = 144; optional GreaterOptions greater_options = 145; optional SqueezeOptions squeeze_options = 146; optional FloorModOptions floormod_options = 147; optional OneHotOptions onehot_options = 148; optional LessOptions less_options = 149; optional ReducerOptions reduce_max_options = 150; optional MaximumMinimumOptions minimum_options = 151; optional ReducerOptions reduce_any_options = 152; optional ZerosLikeOptions zeros_like_options = 153; // ConcatEmbeddingsOptions 154 // LSHProjectionOptions 155 optional SVDFOptions svdf_options = 156; // RNNOptions 157 optional L2NormOptions l2norm_options = 158; optional LocalResponseNormalizationOptions local_response_normalization_options = 159; // LSTMOptions 160 optional ResizeBilinearOptions resize_bilinear_options = 161; // CallOptions 162 // SkipGramOptions 163 optional SpaceToDepthOptions space_to_depth_options = 164; // EmbeddingLookupSparseOptions 165 // SequenceRNNOptions 166 optional TopKV2Options topk_v2_options = 167; optional LogSoftmaxOptions log_softmax_options = 168; optional DequantizeOptions dequantize_options = 169; optional NegOptions neg_options = 170; optional PadV2Options padv2_options = 171; optional LessEqualOptions lessequal_options = 172; optional SliceOptions slice_options = 173; optional TransposeConvOptions transpose_conv_options = 174; optional SparseToDenseOptions sparse_to_dense_options = 175; optional PowOptions pow_options = 176; optional ArgMinOptions argmin_options = 177; optional FakeQuantOptions fakequant_options = 178; optional BidirectionalSequenceLSTMOptions bidirectional_sequence_lstm_options = 179; // BidirectionalSequenceRNNOptions 180 optional UnidirectionalSequenceLSTMOptions unidirectional_sequence_lstm_options = 181; optional RangeOptions range_options = 182; optional ResizeNearestNeighborOptions resize_nearest_neighbor_options = 183; optional LeakyReluOptions leaky_relu_options = 184; optional MirrorPadOptions mirrorpad_options = 185; optional UniqueOptions unique_options = 186; optional ReverseV2Options reversev2_options = 187; // AddNOptions 188 optional GatherNdOptions gather_nd_options = 189; optional WhereOptions where_options = 190; optional RankOptions rank_options = 191; optional ReverseSequenceOptions reverse_sequence_options = 192; optional MatrixDiagOptions matrix_diag_options = 193; // QuantizeOptions 194 optional MatrixSetDiagOptions matrix_set_diag_options = 195; // HardSwishOptions 196 optional DepthToSpaceOptions depth_to_space_options = 197; optional NonMaxSuppressionV4Options non_max_suppression_v4_options = 198; optional NonMaxSuppressionV5Options non_max_suppression_v5_options = 199; optional ScatterNdOptions scatter_nd_options = 200; optional NotEqualOptions notequal_options = 201; optional ExpandDimsOptions expand_dims_options = 202; optional Pool2DOptions l2pool2d_options = 203; optional ReducerOptions all_options = 204; optional ReducerOptions reduce_min_options = 205; optional SegmentSumOptions segment_sum_options = 206; optional AddNOptions add_n_options = 207; optional MatMulOptions matmul_options = 208; optional MaxPoolWithArgmaxOptions max_pool_with_argmax_options = 209; optional DensifyOptions densify_options = 210; // NOTE if there are more than two options with same type of Options // use the number not listed in the above reserve list } message TensorMap { optional string name = 4; // use tensor as name of the Operand or use tensor_index as order number. // either one should exist. optional string tensor = 5; optional uint32 tensor_index = 6; } message SignatureDef { repeated TensorMap inputs = 4; repeated TensorMap outputs = 5; optional string signature_key = 6; // optional string key = 10; obsolete in TF2.8.0 optional uint32 subgraph_index = 12; } // 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; repeated SignatureDef signature_def = 8; }