mindspore-ai / mindspore

MindSpore is a new open source deep learning training/inference framework that could be used for mobile, edge and cloud scenarios.
https://gitee.com/mindspore/mindspore
Apache License 2.0
4.31k stars 710 forks source link

[Bug] Unstable results in sin/arcsin/arccos calls #272

Closed Redmept1on closed 7 months ago

Redmept1on commented 7 months ago

Environment

Hardware Environment(Ascend/GPU/CPU):

/device gpu
/device cpu

Software Environment:

Describe the expected behavior

[0,0]

Steps to reproduce the issue

from mindspore import set_context
import mindspore.ops as ops

set_context(device_target="CPU")
x = ops.ones(2)
y = ops.sin(x)
y = ops.arcsin(y) 
y = ops.arccos(y)
print(y)  # gives [0.00034527 0.00034527]

set_context(device_target="GPU")
y1 = ops.sin(x)
y1 = ops.arcsin(y1) 
y1 = ops.arccos(y1)
print(y1) # gives [nan nan] should be [0,0]

image