failed test cases for Tensor.round (#3240)

it should round to even
This commit is contained in:
chenyu
2024-01-25 02:12:50 -05:00
committed by GitHub
parent b0b5eba535
commit da5e27968c

View File

@@ -245,6 +245,12 @@ class TestOps(unittest.TestCase):
def test_round(self):
helper_test_op([(45,35)], lambda x: x.round(), forward_only=True)
helper_test_op(None, lambda x: x.round(), vals=[[1.499, 1.5, 1.501, 1.0, 2.1, 0.0, -5.0, -2.499, -2.5, -2.501]], forward_only=True)
# TODO: implement round to even
with self.assertRaises(Exception):
helper_test_op(None, lambda x: x.round(), vals=[[2.5]], forward_only=True)
with self.assertRaises(Exception):
helper_test_op(None, lambda x: x.round(), vals=[[-1.5]], forward_only=True)
def test_tril(self):
helper_test_op([(3,3)], lambda x: x.tril())
helper_test_op([(3,3)], lambda x: x.tril(1))