You would have to write the backward method, if you are using another library inside the method (e.g. numpy) or if you think the automatically generated backward method might be slower than your custom one.
The example just shows the general approach of doing so.