Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrochukM committed Apr 8, 2018
1 parent dc6e144 commit 1424e80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion torchnlp/samplers/bucket_batch_sampler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import heapq
import pickle
import math

from torch.utils.data.sampler import BatchSampler
from torch.utils.data.sampler import RandomSampler
Expand Down Expand Up @@ -114,4 +115,4 @@ def __len__(self):
if self.drop_last:
return len(self.data) // self.batch_size
else:
return len(self.data) // self.batch_size + 1
return math.ceil(len(self.data) / self.batch_size)
2 changes: 1 addition & 1 deletion torchnlp/samplers/noisy_sorted_batch_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ def __iter__(self):
random.shuffle(batches)
if self.last_batch_first:
batches.insert(0, last_batch)
return iter(batches)
return iter(batches)

0 comments on commit 1424e80

Please sign in to comment.