Paddle
Paddle copied to clipboard
`paddle.divide` Incorrectly Computes Complex Divided by Infinity.
trafficstars
bug描述 Describe the Bug
When dividing a complex number by positive infinity using paddle.divide, the result is (nan+nanj). This is mathematically incorrect. The expected result is (0+0j). The equivalent operation in NumPy produces the correct result, 0j.
import paddle
import numpy as np
print(paddle.__version__)
paddle.set_device('cpu')
x0 = paddle.to_tensor(1.0, dtype='complex128')
x1 = paddle.to_tensor(float('inf'), dtype='float64')
y = paddle.divide(x0, x1)
print(y)
x0_np = np.array(1.0, dtype=np.complex128)
x1_np = np.array(float('inf'), dtype=np.float64)
y_np = np.divide(x0_np, x1_np)
print(y_np)
output:
3.0.0
Tensor(shape=[], dtype=complex128, place=Place(cpu), stop_gradient=True,
(nan+nanj))
0j
其他补充信息 Additional Supplementary Information
No response
你好,这个问题我们已经记录并且近期会进行修复,感谢你的反馈
closed as #73331 has been merged