Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
co63oc committed Nov 12, 2024
1 parent 30c8cdc commit c1640ac
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions paddle2onnx/proto/p2o_paddle.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ package paddle2onnx.framework.proto;
//
// Serailization and Deserialization codes should be modified in a way
// that supports old versions following the version and compatibility policy.
message Version { optional int64 version = 1 [ default = 0 ]; }
message Version {
optional int64 version = 1 [default = 0];
}

enum AttrType {
INT = 0;
Expand All @@ -43,7 +45,6 @@ enum AttrType {
SCALARS = 17;
}


message Complex {
required double r = 1;
required double i = 2;
Expand All @@ -67,7 +68,6 @@ message Scalar {
// OpDesc describes an instance of a C++ framework::OperatorBase
// derived class type.
message OpDesc {

message Attr {
required string name = 1;
required AttrType type = 2;
Expand Down Expand Up @@ -100,22 +100,21 @@ message OpDesc {
repeated Var inputs = 1;
repeated Var outputs = 2;
repeated Attr attrs = 4;
optional bool is_target = 5 [ default = false ];
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 ];
optional bool extra = 6 [ default = false ];
optional bool quant = 7 [ default = false ];
optional bool duplicable = 3 [default = false];
optional bool intermediate = 4 [default = false];
optional bool dispensable = 5 [default = false];
optional bool extra = 6 [default = false];
optional bool quant = 7 [default = false];
}

// AttrProto describes the C++ type Attribute.
Expand All @@ -126,10 +125,10 @@ message OpProto {
// 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 ];
optional bool extra = 5 [ default = false ];
optional bool quant = 6 [ default = false ];
optional bool support_tensor = 7 [ default = false];
optional bool generated = 4 [default = false];
optional bool extra = 5 [default = false];
optional bool quant = 6 [default = false];
optional bool support_tensor = 7 [default = false];
}

required string type = 1;
Expand Down Expand Up @@ -164,7 +163,7 @@ message VarType {
FETCH_LIST = 10;
STEP_SCOPES = 11;
LOD_RANK_TABLE = 12;
LOD_TENSOR_ARRAY = 13;
DENSE_TENSOR_ARRAY = 13;
PLACE_LIST = 14;
READER = 15;
// Any runtime decided variable type is raw
Expand All @@ -190,26 +189,30 @@ message VarType {
message TensorDesc {
// Should only be PODType. Is enforced in C++
required Type data_type = 1;
repeated int64 dims = 2; // [UNK, 640, 480] is saved as [-1, 640, 480]
repeated int64 dims = 2; // [UNK, 640, 480] is saved as [-1, 640, 480]
}
optional TensorDesc selected_rows = 2;

message LoDTensorDesc {
required TensorDesc tensor = 1;
optional int32 lod_level = 2 [ default = 0 ];
optional int32 lod_level = 2 [default = 0];
}
optional LoDTensorDesc lod_tensor = 3;

message LoDTensorArrayDesc {
required TensorDesc tensor = 1;
optional int32 lod_level = 2 [ default = 0 ];
optional int32 lod_level = 2 [default = 0];
}
optional LoDTensorArrayDesc tensor_array = 4;

message ReaderDesc { repeated LoDTensorDesc lod_tensor = 1; }
message ReaderDesc {
repeated LoDTensorDesc lod_tensor = 1;
}
optional ReaderDesc reader = 5;

message Tuple { repeated Type element_type = 1; }
message Tuple {
repeated Type element_type = 1;
}
optional Tuple tuple = 7;

optional TensorDesc string = 8;
Expand All @@ -220,7 +223,6 @@ message VarType {
}

message VarDesc {

message Attr {
required string name = 1;
required AttrType type = 2;
Expand All @@ -231,12 +233,12 @@ message VarDesc {

required string name = 1;
required VarType type = 2;
optional bool persistable = 3 [ default = false ];
optional bool persistable = 3 [default = false];
// True if the variable is an input data and
// have to check the feed data shape and dtype
optional bool need_check_feed = 4 [ default = false ];
optional bool is_parameter = 5 [ default = false ];
optional bool stop_gradient = 6 [ default = false ];
optional bool need_check_feed = 4 [default = false];
optional bool is_parameter = 5 [default = false];
optional bool stop_gradient = 6 [default = false];
repeated Attr attrs = 7;
}

Expand All @@ -245,12 +247,14 @@ message BlockDesc {
required int32 parent_idx = 2;
repeated VarDesc vars = 3;
repeated OpDesc ops = 4;
optional int32 forward_block_idx = 5 [ default = -1 ];
optional int32 forward_block_idx = 5 [default = -1];
}

// In some cases, Paddle may perform operator definition iterations,
// and the operator uses OpVersionMap for compatibility testing.
message OpVersion { required int32 version = 1; }
message OpVersion {
required int32 version = 1;
}
message OpVersionMap {
message OpVersionPair {
required string op_name = 1;
Expand All @@ -265,7 +269,7 @@ message OpVersionMap {
// TODO(panyx0718): A model can have multiple programs. Need a
// way to distinguish them. Maybe ID or name?
message ProgramDesc {
reserved 2, 3; // For backward compatibility.
reserved 2, 3; // For backward compatibility.
repeated BlockDesc blocks = 1;
optional Version version = 4;
optional OpVersionMap op_version_map = 5;
Expand Down

0 comments on commit c1640ac

Please sign in to comment.