https://medium.com/@monocosmo77/understanding-the-use-of-automatic-differentiation-part2-machine-learning-ebc06be4c429