If you have a (N, 1) tensor and another (N), MSELoss won’t work, since it requires both tensors to have the same shape.
You would use .view(-1) on the input tensor or .unsqueeze_(1) on the target tensor.
N = 10
a = torch.randn(N, 1)
b = torch.randn(N)

criterion = nn.MSELoss()
loss = criterion(a, b)  # RuntimeError
loss = criterion(a, b.unsqueeze_(1))