mirror of
https://github.com/ml-explore/mlx.git
synced 2025-08-31 20:14:36 +08:00
std and expm1 (#973)
* std and expm1 * actually add expm1 * fix linux * fix vjp * relax tol for linux test * Add it to the compilable primitives --------- Co-authored-by: Angelos Katharopoulos <a_katharopoulos@apple.com>
This commit is contained in:
@@ -1092,6 +1092,20 @@ TEST_CASE("test arithmetic unary ops") {
|
||||
CHECK(allclose(exp(x), expected).item<bool>());
|
||||
}
|
||||
|
||||
// Test expm1
|
||||
{
|
||||
array x(-1.0f);
|
||||
CHECK_EQ(expm1(x).item<float>(), doctest::Approx(std::expm1(-1.0f)));
|
||||
|
||||
x = array(1.0f);
|
||||
CHECK_EQ(expm1(x).item<float>(), doctest::Approx(std::expm1(1.0f)));
|
||||
|
||||
// Integer input type
|
||||
x = array(1);
|
||||
CHECK_EQ(expm1(x).dtype(), float32);
|
||||
CHECK_EQ(expm1(x).item<float>(), doctest::Approx(std::expm1(1.0f)));
|
||||
}
|
||||
|
||||
// Test sine
|
||||
{
|
||||
array x(0.0);
|
||||
|
Reference in New Issue
Block a user