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