mirror of https://github.com/facebookresearch/deit
update: concatenate paddings when padding_size is over 0
parent
96ac034e60
commit
8f69a7ee85
|
@ -45,8 +45,10 @@ class RASampler(torch.utils.data.Sampler):
|
|||
indices = torch.arange(start=0, end=len(self.dataset))
|
||||
|
||||
# add extra samples to make it evenly divisible
|
||||
indices = torch.repeat_interleave(indices, repeats=self.num_repeats, dim=0).tolist()
|
||||
indices += indices[:(self.total_size - len(indices))]
|
||||
indices = torch.repeat_interleave(indices, repeats=self.num_repeats, dim=0)
|
||||
padding_size: int = self.total_size - len(indices)
|
||||
if padding_size > 0:
|
||||
indices += torch.cat([indices, indices[:padding_size]], dim=0)
|
||||
assert len(indices) == self.total_size
|
||||
|
||||
# subsample
|
||||
|
|
Loading…
Reference in New Issue