I am interested in combined derivatives using Pytorch:
In the implemented code below, I have tried, but the code compute two partial derivative (e.g. it computed firstly d’f/d’x and secondly d’f/d’y). Is it possible modify the code in some way that we can compute this derivative with respect two parameters?
import torch def function(x,y): f = x**3+y**3 return f a = torch.tensor([4., 5., 6.], requires_grad=True) b = torch.tensor([1., 2., 6.], requires_grad=True) derivative = torch.autograd.functional.jacobian(function, (a,b)) print(derivative)