Dynamic batch size allocation

Hi, any ideas if we can set the batch size dynamically based on how much available memory does the GPU has - for all the epochs.