From: Kevin Tse Date: Fri, 10 Sep 2021 18:00:01 +0000 (-0700) Subject: [DataPipe] fixing tests related fork() to remove warnings (#64827) X-Git-Tag: accepted/tizen/8.0/unified/20231005.095509~303 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5060b69d62943e11f053f8c86b8154a7d009af11;p=platform%2Fupstream%2Fpytorch.git [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 --- 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)