'How to compute derivative of a neural network model at a particular point using MATLAB?
In using neural networks for solving differential equations, using MATLAB, I could find derivative of the model using the command 'dlgradient'. i.e.
gradientsU = dlgradient(sum(U,'all'),{dlX},'EnableHigherDerivatives',true)
where U is the model found using fullyconnect and dlX is the input.
Now, how we can calculate derivative at a particular point of the model U.
To be specific I wanted to add derivative of the model at a particular point, say U_0=U'(5) to the loss function. So, how can I compute that?
I have followed the documentation given in MATLAB, given by,
"To evaluate Rosenbrock's function and its gradient at the point [–1,2], create a dlarray of the point and then call dlfeval on the function handle @rosenbrock.
x0 = dlarray([-1,2]);
[fval,gradval] = dlfeval(@rosenbrock,x0);
But I have already called using dlfeval to evaluate the model, so, not able to call dlfeval again. And when I'm trying to directly compute using the command dlfeval(@U,U_0), the output is always zero.
It will be really helpful if some insight could be provided. Thanks in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
