def half_test_2(self): t1 = TensorBase(np.array([[1.1, 2.1], [1.11, 2.11]])) self.assertTrue(np.alltrue(t1.half() == np.array([[1.1, 2.1], [1.11, 2.11]]).astype('float16')))
def half_test_1(self): t1 = TensorBase(np.array([2, 3, 4])) self.assertTrue(np.alltrue(t1.half() == np.array([2, 3, 4]).astype('float16')))