未验证 提交 fa08a834 编写于 作者: 石晓伟 提交者: GitHub

update op_version_registry, test=develop (#26592)

上级 f8dbd7a2
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册