I wrote this code in Python using Sympy module. Could you please let me know what’s the best way to write similar code in Pytorch? I basically wanted to calculate Jacobian which is a 2 by 2 matrix w.r.t inputs (q1,q2). I am really having a hard time here. Thanks.
Did you check torch.autograd.functional.jacobian already to see if this would work for your use case?
You should be able to replace the other method directly with PyTorch operations, e.g. asin with torch.asin.
And I believe that it will work well. Will I face any difficulty training those self.weights bcoz I used autograd.grad? I heard that it would cause some problems with retaining the graph or something. I am not sure.