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

Commit 1424e80

Browse files
committed
Fix tests
1 parent dc6e144 commit 1424e80

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

torchnlp/samplers/bucket_batch_sampler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import heapq
22
import pickle
3+
import math
34

45
from torch.utils.data.sampler import BatchSampler
56
from torch.utils.data.sampler import RandomSampler
@@ -114,4 +115,4 @@ def __len__(self):
114115
if self.drop_last:
115116
return len(self.data) // self.batch_size
116117
else:
117-
return len(self.data) // self.batch_size + 1
118+
return math.ceil(len(self.data) / self.batch_size)

torchnlp/samplers/noisy_sorted_batch_sampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ def __iter__(self):
7474
random.shuffle(batches)
7575
if self.last_batch_first:
7676
batches.insert(0, last_batch)
77-
return iter(batches)
77+
return iter(batches)

0 commit comments

Comments
 (0)