Automatic Differentiation in PyTorch
Thanks to it, we don't need to worry about partial derivatives, chain rule, or anything like it. To illustrate how it works, let's say we're trying to fit a simple linear regression with a single feature x, using Mean Squared Error (MSE) as our loss: We need to create two tensors, one for each parameter our model needs to learn: b and w. Without PyTorch, we would have to start with our loss, and work the partial derivatives out to compute the gradients manually. Sure, it would be easy enough to do it for this toy problem, but we need something that can scale. So, how do we do it?
Nov-24-2020, 23:20:09 GMT