Skip to content

Commit 0355e6c

Browse files
committed
fix float16
1 parent 45fa080 commit 0355e6c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/paddle/tensor/math.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7678,7 +7678,8 @@ def sinc(x, name=None):
76787678
if not isinstance(x, (paddle.Tensor, Variable, paddle.pir.Value)):
76797679
raise TypeError(f"x must be tensor type, but got {type(x)}")
76807680

7681-
tmp = math.pi * paddle.where(x == 0, 1.0e-20, x)
7681+
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))
76827683
return paddle.divide(tmp.sin(), tmp)
76837684

76847685

0 commit comments

Comments
 (0)