From 5060b69d62943e11f053f8c86b8154a7d009af11 Mon Sep 17 00:00:00 2001 From: Kevin Tse Date: Fri, 10 Sep 2021 11:00:01 -0700 Subject: [PATCH] [DataPipe] fixing tests related fork() to remove warnings (#64827) Summary: There are two warnings produced by `test_fork_datapipe`. This PR addresses the issues raised by those warnings without impacting the test cases. cc VitalyFedyunin ejguan Pull Request resolved: https://github.com/pytorch/pytorch/pull/64827 Reviewed By: ejguan Differential Revision: D30870528 Pulled By: NivekT fbshipit-source-id: 580a001c6fa3ff6f8b04a7e5183e58861938204b --- test/test_datapipe.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/test_datapipe.py b/test/test_datapipe.py index 15cb059..b77d0a1 100644 --- a/test/test_datapipe.py +++ b/test/test_datapipe.py @@ -606,8 +606,7 @@ class TestFunctionalIterDataPipe(TestCase): # Test Case: making sure all child DataPipe shares the same reference dp1, dp2, dp3 = input_dp.fork(num_instances=3) - self.assertTrue(all(n1 is n2 for n1, n2 in zip(dp1, dp2))) - self.assertTrue(all(n1 is n3 for n1, n3 in zip(dp1, dp3))) + self.assertTrue(all(n1 is n2 and n1 is n3 for n1, n2, n3 in zip(dp1, dp2, dp3))) # Test Case: one child DataPipe yields all value at a time output1, output2, output3 = list(dp1), list(dp2), list(dp3) @@ -680,7 +679,6 @@ class TestFunctionalIterDataPipe(TestCase): output1, output2 = list(dp1), list(dp2) self.assertEqual(list(range(10)), output1) self.assertEqual(list(range(10)), output2) - output1, output2 = list(dp1), list(dp2) with warnings.catch_warnings(record=True) as wa: self.assertEqual(list(range(10)), list(dp1)) # Resets even though dp3 has not been read self.assertEqual(len(wa), 1) -- 2.7.4