How to select batch size automatically to fit GPU?

Viewed 16303

I am training deep neural networks with a GPU. If I make samples too large, batches too large, or networks too deep, I get an out of memory error. In this case, it is sometimes possible to make smaller batches and still train.

Is it possible to calculate GPU size required for training and determine what batch size to choose beforehand?

UPDATE

If I print network summary, it displays number of "trainable parameters". Can't I estimate from this value? For example, take this, multiply by batch size, double for gradients etc?

3 Answers
Related