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

Paddle 对 inf 的处理有问题 #44356

Closed
tiancaishaonvjituizi opened this issue Jul 15, 2022 · 3 comments
Closed

Paddle 对 inf 的处理有问题 #44356

tiancaishaonvjituizi opened this issue Jul 15, 2022 · 3 comments
Assignees
Labels
status/close 已关闭 type/feature-request 新需求申请

Comments

@tiancaishaonvjituizi
Copy link
Contributor

tiancaishaonvjituizi commented Jul 15, 2022

bug描述 Describe the Bug

Reference:#42469 (comment)

>>> import paddle
>>> x=paddle.to_tensor([1,2,float('inf')])
>>> x==x
Tensor(shape=[3], dtype=bool, place=Place(gpu:0), stop_gradient=True,
       [True , True , False])

这表示在 paddle 里,inf == inf 是 false,这和 IEEE754 以及 Python 和 C++ 语言的实现都不一致,也和 PyTorch 不一致:

Python:

>>> float('inf')==float('inf')
True

C++:

$ cat test.cpp
#include <iostream>
#include <limits>

int main() {
  std::cout << (std::numeric_limits<float>::infinity ==
                std::numeric_limits<float>::infinity)
            << std::endl;
}
$ g++ test.cpp
$ ./a.out
1

PyTorch:

>>> import torch
>>> x=torch.tensor([1,2,float('inf')])
>>> x==x
tensor([True, True, True])

其他补充信息 Additional Supplementary Information

No response

@paddle-bot
Copy link

paddle-bot bot commented Jul 15, 2022

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

@FeixLiu FeixLiu added the type/feature-request 新需求申请 label Jul 15, 2022
@paddle-bot paddle-bot bot removed the type/bug-report 报bug label Jul 15, 2022
@FeixLiu
Copy link
Contributor

FeixLiu commented Jul 15, 2022

感谢您提出的issue,我们会内部对该现象进行讨论。如有最新进展,会及时回复。

@tiancaishaonvjituizi
Copy link
Contributor Author

Fixed in #44667

@paddle-bot paddle-bot bot added status/close 已关闭 and removed status/new-issue 新建 labels Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/close 已关闭 type/feature-request 新需求申请
Projects
None yet
Development

No branches or pull requests

2 participants