Hi,
The grads are computed for each elementary functions from the end to the start.
You might want to check with a simple model if you want to write the formula by hand.
Also I’m not sure the formula for the gradient fo the smooth l1 loss is correct in the one like you shared.
If you want to print the graph of all the backward functions, I would recommend this 6 package which will make it much easier to visualize.