Skip to content

Conversation

@DesmonDay
Copy link
Contributor

PR types

Bug fixes

PR changes

OPs

Describe

Add grad kernel for diag_v2 op.

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

int,
int64_t,
float,
double) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

float16也给注册上去

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

按照之前讨论的,这里const & 可以不适用,风格保持一致,前面的代码没有使用const &

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

前后代码风格保持一致,去除const &

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@wawltor wawltor self-requested a review March 14, 2022 12:05
Copy link
Contributor

@wawltor wawltor left a comment

Choose a reason for hiding this comment

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

LGTM

@wawltor wawltor merged commit e157f2a into PaddlePaddle:develop Mar 14, 2022
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.

2 participants