Steps per Epoch Calculator
Calculate the number of training steps in one epoch from dataset and batch size.
Inputs
If enabled, a partial final batch is dropped rather than processed.
Set to 0 to omit total training steps.
Steps per Epoch
3,125
Final Batch Size
32
Total Training Steps
31,250
Step by step
Steps per epoch: ceil(dataset_size ÷ batch_size)
ceil(100,000 ÷ 32)
= 3,125
Drop last disabled: ceil is used
3,125 steps/epoch
= 3,125
Total steps: steps_per_epoch × total_epochs
3,125 × 10
= 31,250
How it works
The number of optimizer steps in one epoch is the dataset size divided by the batch size, rounded up (ceil) if the final partial batch is still processed, or rounded down (floor) if it's dropped. Most training loops default to processing the final partial batch (steps = ceil(dataset_size / batch_size)), which is why the last batch of an epoch is often smaller than the configured batch size unless the dataset size divides evenly.
Formula
steps_per_epoch = ceil(dataset_size / batch_size) [or floor if drop_last=True]
- dataset_size
- Total number of samples in the dataset
- batch_size
- Samples per training step
Frequently Asked Questions
When should I enable 'Drop Incomplete Final Batch'?
Enable it when your training code uses drop_last=True (common in PyTorch DataLoader) to keep every batch the exact same size — useful for batch-norm statistics or fixed-shape hardware kernels — at the cost of not seeing a small fraction of the data each epoch.
Why does the final batch size differ from my configured batch size?
Unless dataset_size is an exact multiple of batch_size, the last batch in an epoch contains the remainder, e.g. 100 samples with batch size 32 gives three full batches of 32 plus one final batch of 4.
How does this relate to the Epoch Calculator?
This calculator solves for steps per epoch directly from dataset and batch size; the Epoch Calculator uses that relationship in reverse to convert between a total step budget and an equivalent number of epochs.
Does gradient accumulation change steps per epoch?
It changes how many optimizer updates occur, but not how many micro-batches are read — if you want optimizer steps per epoch under accumulation, divide this result by your accumulation step count.