Dynamic batch size

How to change my batch size on every batch or epoch? Should this be done with a callback or a scheduler?

Yes you could use a callback.

The batch size is a parameter of the dataloader. So you will have to redefine the learn.data.train_dl with a new batch_size after every epoch or batch. This might be really inefficient but it is probably the easiest way without coming up with a new type of DataLoader altogether.

1 Like