-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Remove axis in some elementwise api #50190
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
if in_dygraph_mode(): | ||
return _C_ops.add_(x, y) | ||
else: | ||
out = _elementwise_op_in_dygraph(x, y, axis=axis, op_name=op_type) | ||
return out | ||
return _C_ops.add_(x, y) |
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.
本函数的前置逻辑,也可以删除,后续的几个函数同理
op_type = 'elementwise_add_'
axis = -1
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.
Done, thx~
# This rule is obscure, so we maybe replace it by adding new design in the future. | ||
if is_inplaced and ( | ||
self.forward_api_name[-1] != '_' | ||
or self.forward_api_name == 'assign_out_' |
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.
此处为什么要特殊处理
Why do we need this special case?
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.
这个属于inplace处理机制的遗留问题,一般对于有反向的inplace接口都需要做InplaceCheck处理,但assign_out_早期没有加InplaceCheck导致现在加上就会有不兼容问题,所以暂时只能通过黑名单来跳过
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
APIs
Describe
elementwise系列算子中的axis目前已不再推荐使用,为了减少该类接口不规范的使用,本PR对部分elementwise接口中的axis参数进行了清理,并删除了一些不再使用的接口。