Increasing the memory demand. I mean, start from a small batch size and increase it checking gpu usage with nvidia-smi. You need to compute the backward as well since it requires memory. When you see you can compute forward and backward reaching the memory limit thats the maximum batch siD you can use