keras/keras_core/testing/test_case.py

14 lines
425 B
Python
Raw Normal View History

2023-04-09 19:21:45 +00:00
import unittest
import numpy as np
2023-04-09 19:21:45 +00:00
class TestCase(unittest.TestCase):
def assertAllClose(self, x1, x2, atol=1e-7, rtol=1e-7):
np.testing.assert_allclose(x1, x2, atol=atol, rtol=rtol)
def assertAlmostEqual(self, x1, x2, decimal=3):
np.testing.assert_almost_equal(x1, x2, decimal=decimal)
def assertLen(self, iterable, expected_len):
2023-04-22 16:25:19 +00:00
np.testing.assert_equal(len(iterable), expected_len)