I don’t know what “flushing the unused batches in GPU” means, but in case you are wondering when tensors are deleted: once all references are deleted, the tensor will be released.
If you want to transfer the data to the GPU inside the Dataset, you would have to make sure multiprocessing works fine in this setup, and I would recommend to check the actual performance (once it’s working) to check, if you would see any speedups.