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

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

Loading…
Cancel
Save