Previous | Next --- Slide 42 of 46
Back to Lecture Thumbnails

For automatic differentiation, all operations must leave function still differentiable, right? Otherwise the numeric diff. values would not make any sense. (I guess it is up to the programmer to implement operator anyways and in those cases, there won't be sensible operations to the accumulated diff. values?)


@harveybia Nope, they don't have to be differentiable everywhere---in fact, this is quite easy to implement, since autodiff considers only the derivative at one particular point. Consider for instance the absolute value function $f(x) = |x|$. For values $x < 0$, autodiff will produce $(|x|,-1)$; for values $x > 0$ it will produce $(x,1)$. There is of course the question of what to do at $x=0$, which is behavior that can be defined by the programmer. For instance, in this case returning $(0,0)$ seems reasonable.