Different batch_size for train and valid data loaders

I am trying Image segmentation Course v3 (camVid) Image segmentation. Segmentation for this dataset is working alright but found something confusing.

I set bs = 8 (batch size equal to 8).

data.train_dl.batch_size gives me value of “8” as expected but
data.valid_dl.batch_size gives me value of “12” .

valid_dl.batch size always stay at “1.5 * bs” even for Carvana dataset.

Is this by design?

1 Like

Yes, you don’t compute the gradients for the validation set, so you have more GPU memory available. Usually it’s even bs*2 vor the validation set.


Thank you!