Open Redmept1on opened 3 months ago
When nan is an element in tensor, the output of oneflow.max/min will have a value that does not correspond to indice.
for oneflow.max, if the values output is right, the indices should be indices=tensor([2, 2], dtype=oneflow.int64))
import oneflow as flow import numpy as np a = flow.tensor(np.array([[1, 2, 3], [float('nan'), 5, 6]]),dtype=flow.float32) max_flow = flow.max(a,dim=1) print(max_flow)
for oneflow.min, if the values output is right, the indices should be indices=tensor([0, 1], dtype=oneflow.int64))
import oneflow as flow import numpy as np a = flow.tensor(np.array([[1, 2, 3], [float('nan'), 5, 6]]),dtype=flow.float32) min_flow = flow.min(a,dim=1) print(min_flow)
Summary
When nan is an element in tensor, the output of oneflow.max/min will have a value that does not correspond to indice.
Code to reproduce bug
for oneflow.max, if the values output is right, the indices should be indices=tensor([2, 2], dtype=oneflow.int64))
for oneflow.min, if the values output is right, the indices should be indices=tensor([0, 1], dtype=oneflow.int64))
System Information