There was an error while loading. Please reload this page.
1 parent 45fa080 commit 0355e6cCopy full SHA for 0355e6c
python/paddle/tensor/math.py
@@ -7678,7 +7678,8 @@ def sinc(x, name=None):
7678
if not isinstance(x, (paddle.Tensor, Variable, paddle.pir.Value)):
7679
raise TypeError(f"x must be tensor type, but got {type(x)}")
7680
7681
- tmp = math.pi * paddle.where(x == 0, 1.0e-20, x)
+ tmp = paddle.where(x != 0, x, paddle.full_like(x, 1.0e-20))
7682
+ tmp = paddle.multiply(tmp, paddle.to_tensor(math.pi, dtype=x.dtype))
7683
return paddle.divide(tmp.sin(), tmp)
7684
7685
0 commit comments