Skip to content

Commit

Permalink
Fix bug in BufferShuffleSampler
Browse files Browse the repository at this point in the history
  • Loading branch information
gpengzhi authored and huzecong committed Jul 22, 2019
1 parent d5bf9c2 commit 859ec78
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion texar/data/data/data_iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def __init__(self, data: DataBase[Any, Example], buffer_size: int):

def _iterator_given_size(self, size) -> Iterator[int]:
if self.buffer_size >= size:
return iter(torch.randperm(size).tolist())
yield from iter(torch.randperm(size).tolist())
return

buffer = list(range(self.buffer_size))
for x in range(self.buffer_size, size):
Expand Down

0 comments on commit 859ec78

Please sign in to comment.