Skip to content
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

[NewIR] support elementwise operations with axis!=-1 #55699

Merged
merged 5 commits into from
Jul 31, 2023

Conversation

kangguangli
Copy link
Contributor

PR types

Others

PR changes

Others

Description

close #55485

Others

Pcard-67164

Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall

"Expected op[%s]'s input X has only 1 variable, but got %d",
op_desc.Type(),
x_names.size());
auto x_name = x_names[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后续可以留意下auto的位置是否可以优先使用auto&,除了有copy的开销,更重要的是有时候可能会触发隐藏的bug(之前跟zhiqiu一起遇到过)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,之后会注意下。

ir::OpResult y_new;
if (std::find(y_shape.begin(), y_shape.end(), -1) == y_shape.end()) {
std::vector<int64_t> y_new_shape(y_shape);
for (int i = 0; i <= append_size; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not Important,但++i好像更高效些,可以看下二者的区别

Suggested change
for (int i = 0; i <= append_size; i++) {
for (int i = 0; i <= append_size; ++i) {

@kangguangli kangguangli merged commit b0ea134 into PaddlePaddle:develop Jul 31, 2023
@kangguangli kangguangli deleted the fix_elementwise_op branch July 31, 2023 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NewIR][ProgramTranslator] 支持elementwise算子的axis!=-1的情形
2 participants