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

【NPU】Add TensorCopy to NPU kernel for reduce_sum op #31666

Closed
wants to merge 9 commits into from

Conversation

pangyoki
Copy link
Contributor

PR types

Bug fixes

PR changes

OPs

Describe

PR #31620reduce_sum op 添加了 NPU Kernel。

  • 问题
    NPU Kernel 实现中,求反向,创建临时Tensor时,未对该临时Tensor赋值。会导致reduce_sum op的反向计算错误,观察到错误的梯度全部为0。

  • 修复
    这个PR修复了这个问题,使用TensorCopy,将grad_out的值赋值给创建的临时变量。

  • 反向计算错误时单测通过的原因
    因为组网时,reduce_sum前面的网络中没有任何参数,即使reduce_sum导致梯度计算错误,也不会影响参数更新。
    图片

@CLAassistant
Copy link

CLAassistant commented Mar 16, 2021

CLA assistant check
All committers have signed the CLA.

@pangyoki pangyoki changed the base branch from develop to ascendrc March 16, 2021 11:04
@paddle-bot-old
Copy link

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

@pangyoki pangyoki closed this Mar 16, 2021
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