Skip to content

Commit

Permalink
Prevent DataLoader from not working in cases where the total number o…
Browse files Browse the repository at this point in the history
…f samples is less than the batch number (especially useful for val and test)
  • Loading branch information
louisPoulain committed Jun 27, 2024
1 parent 1a7129a commit f6e11bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mlpp_lib/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def __init__(
self.shuffle = shuffle
self.block_size = block_size
self.num_samples = len(self.dataset.x)
self.num_batches = self.num_samples // batch_size
self.num_batches = self.num_samples // batch_size if batch_size <= self.num_samples else 1
self._indices = tf.range(self.num_samples)
self._seed = 0
self._reset()
Expand Down

0 comments on commit f6e11bc

Please sign in to comment.