I want to know the best way to reshape tensors inside forward function as they take up a lot of memory.
with torch.no_grad():
            x = x.view(-1,150,1024,size,size)

or
x = x.view(-1,150,1024,size,size).detach()
I am not sure which one is better or they both are the same, but the time it took to process one batch was 1.7 sec in the first case and 2.2 sec in the second case. Also, how will backpropagation take place in both cases. Sorry for not making it clear.