-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【new ir】add __eq__ and __hash__ to compare opresult and value #55909
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
return false; | ||
} | ||
}) | ||
.def("__eq__", &OpResult::operator==) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有了下面的重载,这一句是不是已经不需要了啊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下面的判断opresult == value 的重载
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall
.dyn_cast<ir::BoolAttribute>() | ||
.data(); | ||
} else { | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
若没有定义stop_gradient属性,默认策略是False,这个要留意下后续是否有什么影响
friend Operation; | ||
|
||
detail::ValueImpl *value_impl() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么不返回const detail::ValueImpl *
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
Others
PR changes
Others
Description
pcard-67164
增加opresult 结构和 value 结构判等方法__eq__; hash,使得指向相同地址的opresult 和 value 在python端可以判断正确(==, is, value in opresult_set)