I don’t think there’s a straighforward way to set the batch size. One obviously aims to maximize the batch size to improve the raw processing performance. So you increase until you ran out of memory and dial it back again.
Not that with increasing (decreasing) batch size, you might also increase (decrease) the learning rate. Since you average the gradients over the whole badge, larger batches tend to have smaller gradients.