Loss

Learn about how loss can be computed using loss functions and how the loss tensor can be converted to a Numpy array.

Introduction to loss functions

We will now tackle the loss computation process. As expected, PyTorch got us covered once again. There are many loss functions to choose from depending on the task at hand. Since ours is a regression, we are using the Mean Squared Error (MSE) as our loss, and thus we need PyTorch’s nn.MSELoss:

Get hands-on with 1200+ tech skills courses.