Loss functions like MSELoss and CrossEntropyLoss measure how far the model's predictions are from the true answers during training.
MSELoss (Mean Squared Error) is used for tasks where the output is a number, like predicting house prices. It calculates the average of the squared differences between predicted and actual values. Smaller loss means better predictions.
CrossEntropyLoss is used for classification tasks, like telling if an image is a cat or dog. It measures how well the predicted probabilities match the true class labels. Lower loss means the model is more confident and correct.
Tracking loss helps us know if the model is learning or not. It guides the model to improve step by step.