Use custom loss function for training ML task

hi @sgugger,
in the link you attached above, I have a question related to the example.
why do we need this line of code when computing loss?

loss = loss_fct(logits.view(-1, self.model.config.num_labels), labels.view(-1))

I mean the .view() method. why do we have to reshape logits tensors?