Skip to content
Snippets Groups Projects
Commit 4b101ece authored by continue's avatar continue Committed by Kai Chen
Browse files

Fix Sampler bug: index out of range when num_extra < len(indice) (#1610)

* Fix bug: index out of range when num_extra < len(indice)

* Fix bug: index out of range when num_extra < len(indice)

* formatter code
parent 93aa32de
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,8 @@ class GroupSampler(Sampler):
np.random.shuffle(indice)
num_extra = int(np.ceil(size / self.samples_per_gpu)
) * self.samples_per_gpu - len(indice)
indice = np.concatenate([indice, indice[:num_extra]])
indice = np.concatenate(
[indice, np.random.choice(indice, num_extra)])
indices.append(indice)
indices = np.concatenate(indices)
indices = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment