update op_version_registry, test=develop (#26592)

test_feature_precision_test_c
石晓伟 5 years ago committed by GitHub
parent f8dbd7a273
commit fa08a834be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -48,11 +48,15 @@ struct ModifyAttr : OpUpdateRecord {
boost::any default_value_;
};
struct NewAttr : OpUpdateRecord {
NewAttr(const std::string& name, const std::string& remark)
: OpUpdateRecord({Type::kNewAttr, remark}), name_(name) {}
NewAttr(const std::string& name, const std::string& remark,
boost::any default_value)
: OpUpdateRecord({Type::kNewAttr, remark}),
name_(name),
default_value_(default_value) {}
private:
std::string name_;
boost::any default_value_;
};
class OpVersionDesc {
@ -64,9 +68,10 @@ class OpVersionDesc {
return *this;
}
OpVersionDesc& NewAttr(const std::string& name, const std::string& remark) {
infos_.push_back(
std::shared_ptr<OpUpdateRecord>(new compatible::NewAttr(name, remark)));
OpVersionDesc& NewAttr(const std::string& name, const std::string& remark,
boost::any default_value) {
infos_.push_back(std::shared_ptr<OpUpdateRecord>(
new compatible::NewAttr(name, remark, default_value)));
return *this;
}

@ -32,7 +32,8 @@ TEST(test_operator_version, test_operator_version) {
"Increased from the original one method to two.", -1)
.NewAttr("size",
"In order to represent a two-dimensional rectangle, the "
"parameter size is added."))
"parameter size is added.",
0))
.AddCheckpoint(
R"ROC(
Add a new attribute [height]
@ -40,7 +41,8 @@ TEST(test_operator_version, test_operator_version) {
framework::compatible::OpVersionDesc().NewAttr(
"height",
"In order to represent a two-dimensional rectangle, the "
"parameter height is added."));
"parameter height is added.",
0));
}
} // namespace compatible
} // namespace framework

Loading…
Cancel
Save