oneflow icon indicating copy to clipboard operation
oneflow copied to clipboard

oneflow.matmul doesn't work for this situation

Open Redempt1onzzZZ opened this issue 1 year ago • 1 comments

Summary

oneflow.matmul doesn't work for this situation

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

image

pytorch

import torch
import numpy as np

input_tensor = torch.tensor(np.array([float('inf'), 0, -1, float('nan'), 5], dtype=np.float32))
other_tensor = torch.tensor(np.array([float('nan'), 0, -1, 1, 5], dtype=np.float32))
output_tensors = torch.matmul(input_tensor,other_tensor)

print(output_tensors)

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

Redempt1onzzZZ avatar Apr 01 '24 08:04 Redempt1onzzZZ

Sorry to bother, it's obvious that my issues are ignored, maybe some confirmation or attention needed. @levi131

Redempt1onzzZZ avatar Jul 24 '24 09:07 Redempt1onzzZZ