Automatic Differentiation in Deep Learning
Nikhil Ketkar, Jojo Moolayil
Abstract
While exploring stochastic gradient descent in Chapter 3, we treated the computation of gradients of the loss function ∇xL(x) as a black box. In this chapter, we open the black box and cover the theory and practice of automatic differentiation, as well as explore PyTorch’s Autograd module that implements the same. Automatic differentiation is a mature method that allows for the effortless and efficient computation of gradients of arbitrarily complicated loss functions. This is critical when it comes to minimizing loss functions of interest; at the heart of building any deep learning model lies an optimization problem that is invariably solved using stochastic gradient descent, which, in turn, requires one to compute gradients.