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] change ScatterAdd to EmbeddingDenseGrad in lookup_table NPU op #33866

Merged
merged 3 commits into from
Jul 12, 2021

Conversation

pangyoki
Copy link
Contributor

@pangyoki pangyoki commented Jun 30, 2021

PR types

Performance optimization

PR changes

OPs

Describe

将lookup_table_v2 npu op中的ZerosLike + ScatterAdd的实现改成了EmbeddingDenseGrad.

  • 问题:
    EmbeddingDenseGrad仅支持词向量维度为32的倍数的情况。
    图片

测试 dim = 8 / 16 / 20 / 48 / 60 时,使用EmbeddingDenseGrad失败。
测试 dim = 32 / 64 时,使用EmbeddingDenseGrad成功。

因此,当词向量维度为32的倍数时,使用EmbeddingDenseGrad实现
图片

当词向量维度不是32的倍数时,使用ZerosLike + ScatterAdd实现
图片

  • 单测运行结果

图片

@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 force-pushed the use_EmbeddingDenseGrad branch from 6a8d520 to 9fe4be0 Compare July 7, 2021 11:41
Copy link
Contributor

@zhiqiu zhiqiu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

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

LGTM

@pangyoki pangyoki merged commit 4d84205 into PaddlePaddle:develop Jul 12, 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