Pytorch dataloader and collate_fn

Hi,
“Batch sizes” in “train loader” should be changed during the training based on the result of some other function. Maybe collate_fn in “train loader” can be useful. Could you give an example to change Batch_size(for example based on the following simple function):

if Sth%2==0:
   Batch_size += 1