/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ syntax = "proto2"; option optimize_for = LITE_RUNTIME; package paddle.framework.proto; enum AttrType { INT = 0; FLOAT = 1; STRING = 2; INTS = 3; FLOATS = 4; STRINGS = 5; BOOLEAN = 6; BOOLEANS = 7; BLOCK = 8; LONG = 9; } // OpDesc describes an instance of a C++ framework::OperatorBase // derived class type. message OpDesc { message Attr { required string name = 1; required AttrType type = 2; optional int32 i = 3; optional float f = 4; optional string s = 5; repeated int32 ints = 6; repeated float floats = 7; repeated string strings = 8; optional bool b = 10; repeated bool bools = 11; optional int32 block_idx = 12; optional int64 l = 13; }; message Var { required string parameter = 1; repeated string arguments = 2; }; required string type = 3; repeated Var inputs = 1; repeated Var outputs = 2; repeated Attr attrs = 4; optional bool is_target = 5 [ default = false ]; }; // OpProto describes a C++ framework::OperatorBase derived class. message OpProto { // VarProto describes the C++ type framework::Variable. message Var { required string name = 1; required string comment = 2; optional bool duplicable = 3 [ default = false ]; optional bool intermediate = 4 [ default = false ]; optional bool dispensable = 5 [ default = false ]; } // AttrProto describes the C++ type Attribute. message Attr { required string name = 1; required AttrType type = 2; required string comment = 3; // If that attribute is generated, it means the Paddle third // language binding has responsibility to fill that // attribute. End-User should not set that attribute. optional bool generated = 4 [ default = false ]; } required string type = 1; repeated Var inputs = 2; repeated Var outputs = 3; repeated Attr attrs = 4; required string comment = 5; } enum DataType { BOOL = 0; INT16 = 1; INT32 = 2; INT64 = 3; FP16 = 4; FP32 = 5; FP64 = 6; } message TensorDesc { required DataType data_type = 1; repeated int64 dims = 2; // [UNK, 640, 480] is saved as [-1, 640, 480] } message LoDTensorDesc { required TensorDesc tensor = 1; optional int32 lod_level = 2 [ default = 0 ]; } message LoDTensorArrayDesc { required TensorDesc tensor = 1; optional int32 lod_level = 2 [ default = 0 ]; } message Reader { repeated LoDTensorDesc lod_tensor = 1; } message VarDesc { enum VarType { LOD_TENSOR = 1; SELECTED_ROWS = 2; FEED_MINIBATCH = 3; FETCH_LIST = 4; STEP_SCOPES = 5; LOD_RANK_TABLE = 6; LOD_TENSOR_ARRAY = 7; PLACE_LIST = 8; READER = 9; } required string name = 1; required VarType type = 2; optional bool persistable = 3 [ default = false ]; optional LoDTensorDesc lod_tensor = 4; optional TensorDesc selected_rows = 5; optional LoDTensorArrayDesc tensor_array = 6; optional Reader reader = 7; } message BlockDesc { required int32 idx = 1; required int32 parent_idx = 2; repeated VarDesc vars = 3; repeated OpDesc ops = 4; } // Please refer to // https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/program.md // for more details. message ProgramDesc { repeated BlockDesc blocks = 1; }