mirror of
https://github.com/ml-explore/mlx.git
synced 2025-06-24 09:21:16 +08:00
fix simd erf_inv (#1896)
This commit is contained in:
parent
8ff84b5c43
commit
2d0f384b6f
@ -186,7 +186,7 @@ Simd<T, N> erfinv(Simd<T, N> a_) {
|
||||
return a * rhs(t);
|
||||
}
|
||||
} else {
|
||||
return a * select(t > thresh, lhs(t), rhs(t));
|
||||
return a * select(abs(t) > thresh, lhs(t), rhs(t));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ set(BASE_HEADERS
|
||||
bf16_math.h
|
||||
complex.h
|
||||
defines.h
|
||||
erf.h
|
||||
expm1f.h
|
||||
utils.h)
|
||||
|
||||
|
@ -898,6 +898,10 @@ class TestOps(mlx_tests.MLXTestCase):
|
||||
).astype(np.float32)
|
||||
self.assertTrue(np.allclose(mx.erfinv(x), expected, equal_nan=True))
|
||||
|
||||
result = mx.erfinv(mx.array([0.9999999403953552] * 8))
|
||||
expected = mx.array([3.8325066566467285] * 8)
|
||||
self.assertTrue(mx.allclose(result, expected))
|
||||
|
||||
def test_sin(self):
|
||||
a = mx.array(
|
||||
[0, math.pi / 4, math.pi / 2, math.pi, 3 * math.pi / 4, 2 * math.pi]
|
||||
|
Loading…
Reference in New Issue
Block a user