Skip to content

Commit

Permalink
[DataPipe] fixing tests related fork() to remove warnings (pytorch#64827
Browse files Browse the repository at this point in the history
)

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: pytorch#64827

Reviewed By: ejguan

Differential Revision: D30870528

Pulled By: NivekT

fbshipit-source-id: 580a001c6fa3ff6f8b04a7e5183e58861938204b
  • Loading branch information
NivekT authored and facebook-github-bot committed Sep 10, 2021
1 parent ade4bf3 commit 5060b69
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions test/test_datapipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,7 @@ def test_fork_datapipe(self):

# 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)
Expand Down Expand Up @@ -680,7 +679,6 @@ def test_fork_datapipe(self):
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)
Expand Down

0 comments on commit 5060b69

Please sign in to comment.