Hi Gabriel (@gabriel ),
Another issue that you should consider while implementing such a thing is that in many models in neural networks, batch_size is a very sensitive parameters which affects the performance. It would be one thing to find out the best batch size for the entire training purpose and then keep it constant. But since you are changing it at every step, it might lead to instability in performance as well. I would advice you to test this hypothesis as well.