mirror of
https://github.com/ml-explore/mlx.git
synced 2025-10-16 22:28:12 +08:00
Adds round op and primitive (#203)
This commit is contained in:

committed by
GitHub

parent
477397bc98
commit
4d4af12c6f
@@ -862,6 +862,15 @@ TEST_CASE("test arithmetic unary ops") {
|
||||
CHECK_THROWS_AS(ceil(x), std::invalid_argument);
|
||||
}
|
||||
|
||||
// Test round
|
||||
{
|
||||
array x({0.5, -0.5, 1.5, -1.5, 2.3, 2.6});
|
||||
CHECK(array_equal(round(x), array({1, -1, 2, -2, 2, 3})).item<bool>());
|
||||
|
||||
x = array({11, 222, 32});
|
||||
CHECK(array_equal(round(x, -1), array({10, 220, 30})).item<bool>());
|
||||
}
|
||||
|
||||
// Test exponential
|
||||
{
|
||||
array x(0.0);
|
||||
|
Reference in New Issue
Block a user