Well, a detailed loss_fn may help us to fix this problem.
But generally, you shold make an instance of the loss function, where the reduction can be set and then you can call this instance for your calculation of loss.
e.g. loss_fn = nn.MSELoss(reduction='sum') then test_loss += loss_fn(output, label).item()