def test_any_dataset(self): dataset_1 = dataset_ops.DatasetV2.from_tensor_slices([False, True, False]) dataset_2 = dataset_ops.DatasetV2.from_tensor_slices([False, False, False]) self.assertEqual(self.evaluate(py_builtins.any_(dataset_1)), True) self.assertEqual(self.evaluate(py_builtins.any_(dataset_2)), False) dataset_3 = dataset_ops.DatasetV2.from_tensor_slices([0, 1, 2]) with self.assertRaises(ValueError): py_builtins.any_(dataset_3) dataset_4 = dataset_ops.DatasetV2.from_tensor_slices([False, True, False]) dataset_zipped = dataset_ops.DatasetV2.zip((dataset_4, dataset_4)) with self.assertRaises(ValueError): py_builtins.any_(dataset_zipped) dataset_mixed = dataset_ops.DatasetV2.zip((dataset_3, dataset_4)) with self.assertRaises(ValueError): py_builtins.any_(dataset_mixed)
def test_any(self): self.assertEqual(py_builtins.any_([False, True, False]), True) self.assertEqual(py_builtins.any_([False, False, False]), False)