def test_le(self): T_r = ht.uint8([[1, 1], [0, 0]]) T_inv = ht.uint8([[0, 1], [1, 1]]) self.assertTrue(ht.equal(ht.le(s, s), ht.uint8([1]))) self.assertTrue(ht.equal(ht.le(T, s), T_r)) self.assertTrue(ht.equal(ht.le(s, T), T_inv)) self.assertTrue(ht.equal(ht.le(T, T1), T_r)) self.assertTrue(ht.equal(ht.le(T, v), T_r)) self.assertTrue(ht.equal(ht.le(T, s_int), T_r)) self.assertTrue(ht.equal(ht.le(T_s, T), T_inv)) with self.assertRaises(ValueError): ht.le(T, v2) with self.assertRaises(NotImplementedError): ht.le(T, Ts) with self.assertRaises(TypeError): ht.le(T, otherType) with self.assertRaises(TypeError): ht.le('T', 's')
def test_le(self): result = ht.uint8([[1, 1], [0, 0]], device=ht_device) commutated_result = ht.uint8([[0, 1], [1, 1]], device=ht_device) self.assertTrue( ht.equal(ht.le(self.a_scalar, self.a_scalar), ht.uint8([1]))) self.assertTrue(ht.equal(ht.le(self.a_tensor, self.a_scalar), result)) self.assertTrue( ht.equal(ht.le(self.a_scalar, self.a_tensor), commutated_result)) self.assertTrue( ht.equal(ht.le(self.a_tensor, self.another_tensor), result)) self.assertTrue(ht.equal(ht.le(self.a_tensor, self.a_vector), result)) self.assertTrue( ht.equal(ht.le(self.a_tensor, self.an_int_scalar), result)) self.assertTrue( ht.equal(ht.le(self.a_split_tensor, self.a_tensor), commutated_result)) with self.assertRaises(ValueError): ht.le(self.a_tensor, self.another_vector) with self.assertRaises(TypeError): ht.le(self.a_tensor, self.errorneous_type) with self.assertRaises(TypeError): ht.le("self.a_tensor", "s")
def test_le(self): result = ht.array([[True, True], [False, False]]) commutated_result = ht.array([[False, True], [True, True]]) self.assertTrue( ht.equal(ht.le(self.a_scalar, self.a_scalar), ht.array(True))) self.assertTrue(ht.equal(ht.le(self.a_tensor, self.a_scalar), result)) self.assertTrue( ht.equal(ht.le(self.a_scalar, self.a_tensor), commutated_result)) self.assertTrue( ht.equal(ht.le(self.a_tensor, self.another_tensor), result)) self.assertTrue(ht.equal(ht.le(self.a_tensor, self.a_vector), result)) self.assertTrue( ht.equal(ht.le(self.a_tensor, self.an_int_scalar), result)) self.assertTrue( ht.equal(ht.le(self.a_split_tensor, self.a_tensor), commutated_result)) self.assertEqual( ht.le(self.a_split_tensor, self.a_tensor).dtype, ht.bool) with self.assertRaises(ValueError): ht.le(self.a_tensor, self.another_vector) with self.assertRaises(TypeError): ht.le(self.a_tensor, self.errorneous_type) with self.assertRaises(TypeError): ht.le("self.a_tensor", "s")