Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix padding in Iterator for Python 2 #112

Merged
merged 1 commit into from Sep 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions torchtext/data/iterator.py
Expand Up @@ -217,8 +217,8 @@ def __iter__(self):
text = self.dataset[0].text
TEXT = self.dataset.fields['text']
TEXT.eos_token = None
text = text + ([TEXT.pad_token] * (math.ceil(len(text) / self.batch_size) *
self.batch_size - len(text)))
text = text + ([TEXT.pad_token] * int(math.ceil(len(text) / self.batch_size) *
self.batch_size - len(text)))
data = TEXT.numericalize(
[text], device=self.device, train=self.train)
data = data.view(self.batch_size, -1).t().contiguous()
Expand Down