Fix possible padding length overflow in DistributedSampler (#45329)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/45324
This fix handles cases for `len(dataset) * 2 < num_replica` in DistributedSampler. (which previous code resulted in error.)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/45329
Reviewed By: mruberry
Differential Revision: D24205035
Pulled By: rohan-varma
fbshipit-source-id: f94329d9c1e7deaee41e5af319e7c7d0c741910c