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

fix the div 0 error of sparse_embedding #49948

Merged
merged 2 commits into from
Feb 1, 2023

Conversation

Liyulingyue
Copy link
Contributor

PR types

Bug fixes

PR changes

APIs

Describe

@paddle-bot
Copy link

paddle-bot bot commented Jan 19, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Comment on lines +790 to +792
if input.size == 0:
raise ValueError("input size should not be 0")

Copy link
Contributor

Choose a reason for hiding this comment

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

这个报错是哪里报错的?可以在C++端做检查吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Traceback (most recent call last):
  File "bug.py", line 6, in <module>
    paddle.static.nn.sparse_embedding(input, [2097152, 2097152, 2097152, 2097152], padding_idx=2097152)
  File "/home/work/wangying/paddlepaddle/pdpd_fuzz_protobuf/pdpd-env/clang_pd_fuzz_env/lib/python3.8/site-packages/paddle/fluid/contrib/layers/nn.py", line 1205, in sparse_embedding
    w = helper.create_parameter(
  File "/home/work/wangying/paddlepaddle/pdpd_fuzz_protobuf/pdpd-env/clang_pd_fuzz_env/lib/python3.8/site-packages/paddle/fluid/layer_helper_base.py", line 432, in create_parameter
    return self.main_program.global_block().create_parameter(
  File "/home/work/wangying/paddlepaddle/pdpd_fuzz_protobuf/pdpd-env/clang_pd_fuzz_env/lib/python3.8/site-packages/paddle/fluid/framework.py", line 3963, in create_parameter
    initializer(param, self)
  File "/home/work/wangying/paddlepaddle/pdpd_fuzz_protobuf/pdpd-env/clang_pd_fuzz_env/lib/python3.8/site-packages/paddle/fluid/initializer.py", line 72, in __call__
    return self.forward(param, block)
  File "/home/work/wangying/paddlepaddle/pdpd_fuzz_protobuf/pdpd-env/clang_pd_fuzz_env/lib/python3.8/site-packages/paddle/fluid/initializer.py", line 712, in forward
    limit = math.sqrt(6.0 / float(fan_in + fan_out))
ZeroDivisionError: float division by zero

求指路一下c++端文件~

Copy link
Contributor

Choose a reason for hiding this comment

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

啊,抱歉,我看了一下报错。这个是python端的错误。只能加在python端。

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

@luotao1 luotao1 merged commit 3a73d34 into PaddlePaddle:develop Feb 1, 2023
pangengzheng pushed a commit to pangengzheng/Paddle that referenced this pull request Feb 2, 2023
* fix the div 0 error of sparse_embedding

* add unittest
@Liyulingyue Liyulingyue deleted the div0_2 branch February 21, 2023 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants