Adds round op and primitive (#203)

This commit is contained in:
Angelos Katharopoulos
2023-12-18 11:32:48 -08:00
committed by GitHub
parent 477397bc98
commit 4d4af12c6f
17 changed files with 187 additions and 2 deletions

View File

@@ -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);