Meiyang/paddle 2.3 (#13272)

* Migrate to PDPD 2.3

* update supported paddle version to 2.3.2

* update paddle test with paddle new static API on 2.3.2

* fix issue of different output shape with paddle's

* fix clang format issue

* fix compiling issue

* integrate paddle static save model api to original save model api

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
Co-authored-by: Alina Kladieva <alina.kladieva@intel.com>
This commit is contained in:
authored and GitHub committed 2022-10-18 11:14:03 +04:00
1 parent 8e130391f0
commit 7f3c95c161
11 files changed
+117 -72

No files matched your search

+7 -1
View File
@@ -14,7 +14,13 @@ NamedOutputs matmul_v2(const NodeContext& node) {
const auto transpose_a = node.get_attribute<bool>("trans_x", false);
const auto transpose_b = node.get_attribute<bool>("trans_y", false);
const auto mm = std::make_shared<default_opset::MatMul>(x, y, transpose_a, transpose_b);
return node.default_single_output_mapping({mm}, {"Out"});
std::shared_ptr<Node> result = mm;
if (is_scalar(mm->get_output_partial_shape(0))) {
auto unsqueeze_scalar = default_opset::Constant::create(ov::element::i64, {}, {0});
result = std::make_shared<default_opset::Unsqueeze>(mm, unsqueeze_scalar);
}
return node.default_single_output_mapping({result}, {"Out"});
}
} // namespace op
+18 -2
View File
@@ -24,10 +24,26 @@ NamedOutputs reduce_ops(const NodeContext& node) {
dims = node.get_attribute<std::vector<int32_t>>("dim");
}
auto axesNode = default_opset::Constant::create(ngraph::element::i32, {dims.size()}, dims);
return node.default_single_output_mapping({std::make_shared<T>(x, axesNode, keep_dim)}, {"Out"});
bool scalar_output = !keep_dim;
if (scalar_output) {
for (int32_t i = 0; i < input_rank; i++) {
if (std::find(dims.begin(), dims.end(), i) == dims.end()) {
scalar_output = false;
break;
}
}
}
auto reduceNode = std::make_shared<T>(x, axesNode, keep_dim);
std::shared_ptr<Node> result = reduceNode;
if (scalar_output) {
auto unsqueeze_scalar = default_opset::Constant::create(ov::element::i64, {}, {0});
result = std::make_shared<default_opset::Unsqueeze>(reduceNode, unsqueeze_scalar);
}
return node.default_single_output_mapping({result}, {"Out"});
}
} // namespace op
} // namespace paddle
} // namespace frontend
} // namespace ov
} // namespace ov
+37 -2
View File
@@ -11,12 +11,11 @@ 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. */
// Modification Copyright (C) 2018-2022 Intel Corporation
syntax = "proto2";
package paddle.framework.proto;
option optimize_for = LITE_RUNTIME; // Added by Intel Corporation 2021
option optimize_for = LITE_RUNTIME; // Added by Intel Corporation 2021-2022
// Any incompatible changes to ProgramDesc and its dependencies should
// raise the version defined version.h.
@@ -38,6 +37,10 @@ enum AttrType {
LONG = 9;
BLOCKS = 10;
LONGS = 11;
FLOAT64S = 12;
VAR = 13;
VARS = 14;
FLOAT64 = 15;
}
// OpDesc describes an instance of a C++ framework::OperatorBase
@@ -59,6 +62,10 @@ message OpDesc {
optional int64 l = 13;
repeated int32 blocks_idx = 14;
repeated int64 longs = 15;
repeated double float64s = 16;
optional string var_name = 17;
repeated string vars_name = 18;
optional double float64 = 19;
};
message Var {
@@ -84,6 +91,8 @@ message OpProto {
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.
@@ -95,6 +104,9 @@ message OpProto {
// 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];
}
required string type = 1;
@@ -137,6 +149,13 @@ message VarType {
// in operators like nccl_op
RAW = 17;
TUPLE = 18;
STRING = 25;
STRINGS = 26;
VOCAB = 27;
FEED_LIST = 28;
// The data type of phi::StringTensor
PSTRING = 29;
}
required Type type = 1;
@@ -165,15 +184,31 @@ message VarType {
message Tuple { repeated Type element_type = 1; }
optional Tuple tuple = 7;
optional TensorDesc string = 8;
optional TensorDesc strings = 9;
optional TensorDesc vocab = 10;
}
message VarDesc {
message Attr {
required string name = 1;
required AttrType type = 2;
optional int32 i = 3;
optional string s = 4;
repeated int32 ints = 5;
};
required string name = 1;
required VarType type = 2;
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 ];
repeated Attr attrs = 7;
}
message BlockDesc {