MehdiZouitine:

if I have a batch of 20 then the memory used by the graph will be 2 time greater than a batch of 10 ?


More of less. You would have to take e.g. memory fragmentation into consideration. Also, if you are using cudnn with benchmark=True, different algorithms might be picked for different batch sizes depending on their speed, so you might end up with a different memory footprint.