def METHOD_NAME(indices):
    subsampled_indices = []
    last_batch_size = self.total_size % (self.batch_size * self.nranks)
    assert last_batch_size % self.nranks == 0
    last_local_batch_size = last_batch_size // self.nranks
    for i in range(self.local_rank * self.batch_size,
                   len(indices) - last_batch_size,
                   self.batch_size * self.nranks):
        subsampled_indices.extend(indices[i:i + self.batch_size])
    indices = indices[len(indices) - last_batch_size:]
    subsampled_indices.extend(
        indices[self.local_rank * last_local_batch_size:(
            self.local_rank + 1) * last_local_batch_size])
    return subsampled_indices