The target is of shape 2 x 1 while the input is 2, so you could use either target.squeeze(-1) or input.unsqueeze(-1) to make them match (but, obviously, not both or you’d have the symmetric mismatch).
Best regards
Thomas