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

oneflow.max/min perform differently between cpu and cuda. #10475

Open
Redmept1on opened this issue Apr 1, 2024 · 1 comment
Open

oneflow.max/min perform differently between cpu and cuda. #10475

Redmept1on opened this issue Apr 1, 2024 · 1 comment
Labels
bug community events from community

Comments

@Redmept1on
Copy link

Summary

oneflow.max/min perform differently between cpu and cuda.

Code to reproduce bug

oneflow.max

import oneflow as flow
import numpy as np

x1 = flow.tensor(np.array([[float('inf'), 0, -1, float('nan'), 5]], dtype=np.float32))
x1 = x1.cuda()
y1 = flow.max(x1,dim=1)
print(y1)

x1 = flow.tensor(np.array([[float('inf'), 0, -1, float('nan'), 5]], dtype=np.float32))
x1 = x1.cpu()
y2 = flow.max(x1,dim=1)
print(y2)

image

oneflow.min

import oneflow as flow
import numpy as np

x1 = flow.tensor(np.array([[float('inf'), 0, -1, float('nan'), 5]], dtype=np.float32))
x1 = x1.cuda()
y1 = flow.min(x1,dim=1)
print(y1)

x1 = flow.tensor(np.array([[float('inf'), 0, -1, float('nan'), 5]], dtype=np.float32))
x1 = x1.cpu()
y2 = flow.min(x1,dim=1)
print(y2)

image

System Information

  • What is your OneFlow installation :dockerhub
  • OS:Linux
  • OneFlow version (run python3 -m oneflow --doctor):0.9.1.dev20231024+cu117
  • Python version: 3.8
@Redmept1on Redmept1on added bug community events from community labels Apr 1, 2024
@Redmept1on
Copy link
Author

oneflow.median has the same bug

import oneflow as flow
import numpy as np

x1 = flow.tensor(np.array([[float('inf'), 0, -1, float('nan'), 5]], dtype=np.float32))
x1 = x1.cuda()
y1 = flow.median(x1,dim=1)
print(y1)

x1 = flow.tensor(np.array([[float('inf'), 0, -1, float('nan'), 5]], dtype=np.float32))
x1 = x1.cpu()
y2 = flow.median(x1,dim=1)
print(y2)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug community events from community
Projects
None yet
Development

No branches or pull requests

1 participant