Allow specifying num_samples to RandomSampler even when replacement=False (#71568)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/38032 #39214
Hi, I modified the RandomSampler to satisfy the requirement of https://github.com/pytorch/pytorch/issues/38032. I also added and deleted some test cases in the test/test_dataloader.py to match with the new requirement.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71568
Reviewed By: mikaylagawarecki
Differential Revision: D33741776
Pulled By: ejguan
fbshipit-source-id: 2d25f5096b7b36ad9fb6455107182f387cf8ee43
(cherry picked from commit 9c7e1891c220534f1939b57caedd9e9615c65464)