Solved by ptrblck in post #2 
              
              
                You would have to create an object for the loss function and use it afterwards: 
criterion = nn.MSELoss()
loss = criterion(stack_3[0, :], stack_7[0, :])