This is memory allocated.
Printing out the value of torch.cuda.memory_allocated confirms it.
Also, the problem is that the first approach is actually producing better results but its not scalable since it uses too much memory. I am using BatchNorm layers so yeah i get it that output would be different. Good point.