From the course: PyTorch Essential Training: Working with Images

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Loss function and optimizer

Loss function and optimizer

- [Instructor] The loss function is one of the crucial parts of an effective deep learning model. PyTorch uses the loss function to quantify not just whether a prediction is right or wrong, but just how wrong or right it is. Based on the loss function, it determines how to update the network to get the desired results. The loss function is sometimes also called an error function or objective function. Let's understand the whole process in general before moving on to which loss function should we pick. When we begin with training, we can approach it in two ways. Begin training from scratch, in which case the weights of our model would be random. In this approach, the output that we get won't be anything close to what we want. We can use a pre-trained model. This is what we are doing, and it's called transfer learning. In this approach, the model will also need to adjust the weights. We use a loss function to compare the model's output with our targets. We know what results we should…

Contents