Skip to content

Commit

Permalink
BUG: fix sinc for torch (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucascolley authored Dec 9, 2024
1 parent a89ffdd commit ee12cd1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/array_api_extra/_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,8 @@ def sinc(x: Array, /, *, xp: ModuleType | None = None) -> Array:
raise ValueError(err_msg)
# no scalars in `where` - array-api#807
y = xp.pi * xp.where(
x, x, xp.asarray(xp.finfo(x.dtype).eps, dtype=x.dtype, device=x.device)
xp.astype(x, xp.bool),
x,
xp.asarray(xp.finfo(x.dtype).eps, dtype=x.dtype, device=x.device),
)
return xp.sin(y) / y

0 comments on commit ee12cd1

Please sign in to comment.