Skip to content

Commit

Permalink
Fix integer underflow in progress code
Browse files Browse the repository at this point in the history
  • Loading branch information
dae committed Sep 4, 2023
1 parent fe0c27f commit 424fe1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/training.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl ProgressState {
}

pub fn current(&self) -> usize {
(self.epoch - 1) * self.items_total + self.items_processed
self.epoch.saturating_sub(1) * self.items_total + self.items_processed
}

pub fn total(&self) -> usize {
Expand Down

0 comments on commit 424fe1c

Please sign in to comment.