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

[Eager] Refactor TensorAdd by template #39282

Conversation

veyron95
Copy link
Contributor

PR types

Others

PR changes

Others

Describe

  1. Refactor TensorAdd func by template in gradient_accumulater.cc
  2. Remove gradient_accumulation.c and .h in eager/accumulation
  3. Include gradient_accumulator.h instead of including gradient_accumulation.h

@paddle-bot-old
Copy link

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

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

some comment

@@ -214,9 +214,59 @@ void TensorAddImpl(const framework::Tensor& src, framework::Tensor* dst,
func(dev_ctx, src, dst);
}

void TensorAdd(const framework::Variable& src, framework::Variable* dst) {
template <typename VarType>
std::shared_ptr<pten::DenseTensor> GetInnerDstTensor(VarType* dst) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use overload instead of template

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, thx.

@veyron95 veyron95 force-pushed the rafactor_gradient_accumulator_by_template branch from 2e1a9d2 to cbc99da Compare January 27, 2022 12:58
Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

LGTM

@wanghuancoder wanghuancoder merged commit 0bb3e5f into PaddlePaddle:develop Jan 28, 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.

3 participants