Solved by pascal_notsawo in post #2 
              
              
                I already made a post about the jacobian computation with pytorch (as well as the gradient, divergence and laplacian). 
Have a look at it, it might be useful