Difference between symbolic differentiation and automatic differentiation?

There are 3 popular methods to calculate the derivative: Numerical differentiation Symbolic differentiation Automatic differentiation Numerical differentiation relies on the definition of the derivative: , where you put a very small h and evaluate function in two places. This is the most basic formula and on practice people use other formulas which give smaller estimation … Read more

Why don’t C++ compilers do better constant folding?

This is because Eigen explicitly vectorize your code as 3 vmulpd, 2 vaddpd and 1 horizontal reduction within the remaining 4 component registers (this assumes AVX, with SSE only you’ll get 6 mulpd and 5 addpd). With -ffast-math GCC and clang are allowed to remove the last 2 vmulpd and vaddpd (and this is what … Read more

What does the parameter retain_graph mean in the Variable’s backward() method?

@cleros is pretty on the point about the use of retain_graph=True. In essence, it will retain any necessary information to calculate a certain variable, so that we can do backward pass on it. An illustrative example Suppose that we have a computation graph shown above. The variable d and e is the output, and a … Read more