-
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
[Phi]Add diag_v2 grad kernel #40447
[Phi]Add diag_v2 grad kernel #40447
Conversation
Thanks for your contribution! |
int, | ||
int64_t, | ||
float, | ||
double) {} |
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.
float16也给注册上去
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
phi::funcs::SetConstant<Context, T> set_padding_value; | ||
set_padding_value(dev_ctx, x_grad, static_cast<T>(0)); | ||
|
||
const int& dx_stride_0 = phi::funcs::ComputeStride(0, dx_dims); |
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 & 可以不适用,风格保持一致,前面的代码没有使用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.
done
|
||
if (dx_dims.size() == 1) { | ||
auto dx_length = dx_dims[0]; | ||
const int& dx_stride = phi::funcs::ComputeStride(0, dx_dims); |
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 &
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
set_padding_value(dev_ctx, x_grad, static_cast<T>(0)); | ||
|
||
const int& dx_stride_0 = phi::funcs::ComputeStride(0, dx_dims); | ||
const int& dx_stride_1 = phi::funcs::ComputeStride(1, dx_dims); |
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.
done
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
Bug fixes
PR changes
OPs
Describe
Add grad kernel for diag_v2 op.