Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions utils/batcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ def get_training_batch(self, batch_size):
if self.current_state == 0:
random.shuffle(self.training_indices)

if (self.current_state + batch_size) > (len(self.training_indices) + 1):
next_state = self.current_state + batch_size

if next_state > len(self.training_indices):
self.current_state = 0
return self.get_training_batch(batch_size)
else:
self.current_state += batch_size
batch_indices = self.training_indices[self.current_state:(self.current_state + batch_size)]
if len(batch_indices) != batch_size:
self.current_state = 0
return self.get_training_batch(batch_size)
return self.data_handler.slice_data(batch_indices)

batch_indices = self.training_indices[self.current_state:next_state]
self.current_state = next_state

return self.data_handler.slice_data(batch_indices)

def get_validation_batch(self, batch_size):
"""
Expand Down