If you stick to PyTorch methods, Autograd will take care of your backward function, so that you won’t have to implement it yourself.
However, if you are using numpy methods or generally leave PyTorch, you would have to write the backward function yourself.