deepxde icon indicating copy to clipboard operation
deepxde copied to clipboard

Is it possible to compute the gradients after the functions approximation?

Open praksharma opened this issue 2 years ago • 1 comments

After doing a function approximation is it possible to compute gradients using the trained network.

Here is what I am trying to do.

my_data = genfromtxt('dataset.train')
x = my_data[:,0] 
y = my_data[:,1] 
x_np = torch.from_numpy(x)
y_np = torch.from_numpy(y)

<Something to connect them with the neural network graph.>  

dde.grad.hessian(y_np, x_np, i=0, j=0)

Can anyone help me to connect this gradient to the neural network graph?

praksharma avatar Mar 20 '22 15:03 praksharma

See https://deepxde.readthedocs.io/en/latest/demos/pinn_forward/poisson.1d.dirichlet.html

lululxvi avatar Mar 25 '22 14:03 lululxvi