fix SubsetSampler

This commit is contained in:
yanghaitao 2020-06-12 16:06:03 +08:00
parent a6a9f88453
commit 5b0fb71343
1 changed files with 3 additions and 0 deletions

View File

@ -457,6 +457,9 @@ class SubsetRandomSampler(BuiltinSampler):
def get_num_samples(self):
num_samples = super().get_num_samples()
if num_samples is None:
return len(self.indices)
return min(len(self.indices), num_samples)