Oneflow-Inc / oneflow

OneFlow is a deep learning framework designed to be user-friendly, scalable and efficient.
http://www.oneflow.org
Apache License 2.0
5.88k stars 667 forks source link

oneflow.gt/ge/greater/greater_equal perform differently between cpu and cuda. #10477

Open Redmept1on opened 6 months ago

Redmept1on commented 6 months ago

Summary

oneflow.gt/ge/greater/greater_equal perform differently between cpu and cuda. maybe from the same root cause.

Code to reproduce bug

Take greater_equal as an example

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()
x2 = flow.tensor(np.array([float('nan'), 0, -1, 1, 5], dtype=np.float32))
x2 = x2.cuda()
y1 = flow.greater_equal(x1,x2)
print(y1)

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

image

System Information