Skip to content
Snippets Groups Projects
Commit 3dc9ddb7 authored by kkkio's avatar kkkio Committed by Kai Chen
Browse files

Fix #1223 (#1404)

* Fix #1223

#1223  is caused by extra > len(indice), so I add a loop to properly pad the indice list. I also changed the list concatenation from ```+=``` to ```.extend```.

* Update sampler.py

style
parent 78783368
No related branches found
No related tags found
No related merge requests found
......@@ -132,8 +132,12 @@ class DistributedGroupSampler(Sampler):
math.ceil(
size * 1.0 / self.samples_per_gpu / self.num_replicas)
) * self.samples_per_gpu * self.num_replicas - len(indice)
indice += indice[:extra]
indices += indice
# pad indice
tmp = indice.copy()
for _ in range(extra // size):
indice.extend(tmp)
indice.extend(tmp[:extra % size])
indices.extend(indice)
assert len(indices) == self.total_size
......
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