You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[FlagGems Operator Development Competition] Add asinh operator (#2251)
* [FlagGems Operator Development Competition] Add asinh operator
* Drop inf edge cases from asinh test
asinh(-inf) overflows in the log(x + sqrt(x^2+1)) form under fp16 and
returns NaN, diverging from torch. The finite-value and NaN coverage
is sufficient for the accuracy check.
* Fix asinh NaN on -inf via sign(x)*log(|x|+sqrt(x^2+1))
The naive x + sqrt(x^2 + 1) form evaluates to -inf + inf = NaN when
x = -inf, so the kernel returned NaN instead of -inf. Reformulating as
sign(x) * log(|x| + sqrt(x^2 + 1)) uses magnitude in the log branch and
restores the sign, matching torch.asinh across fp16/bf16/fp32 including
the +/- inf edge cases. Restores inf and -inf to the edge-case test.
---------
Co-authored-by: yunyiliu <yunyiliu@users.noreply.github.com>
Co-authored-by: yunyiliu <genius00003@gmail.cm>
0 commit comments