In very brief (for supervised settting)

You do a forward pass, after all the calculations, the final linear layer outputs a vector [1, nc], where nc is the number of classes.
This gets compared to the true classes, and we get a value of loss

This loss gets backpropagated.
Every parameter in the model gets updated with respect to this loss.
You have a better model! Hurray!

Let’s revise, the major the magic word backpropagation
This is an algorithm where each model parameter is compared to the loss.
And we calculate a gradient which is basically a number which has direction and magnitude
Now, this direction is indicated by torch.sign of this value, (i.e. whether positive or negative)
and moving the model parameter in this direction will increase the value of loss by a factor of magnitude.
So, we move in the opposite direction (i.e. negate the gradient) and thus decrease the loss 
That was not very brief, but I think it’s clear.
Also read this: https://medium.com/@karpathy/yes-you-should-understand-backprop-e2f06eab496b 1