Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Higher order derivative by 'dlgradient'
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi
I am currently coding custom deep learning, but the process stopped at the higher derivative.
I am curious about how to make a higher derivative through dlgradient.
Alternatively, you are welcome to suggest a way to do higher derivatives in matlab.
For example, how to get ddydxx in the following example.
-----------------------------------------------------------------------------------------------------------------------
Code
clc,clear,close all
x=3;
x0=dlarray(x);
[fval,gradval,ggradval] = dlfeval(@Myfunc,x0);
function [fval,gradval,ggradval] = Myfunc(x)
y = 100*(3*x - 7*x.^2).^2;
dydx=dlgradient(y,x,'RetainData',true);
ddydxx=dlgradient(dydx,x);
end
-----------------------------------------------------------------------------------------------------------------------
Error
Error using dlfeval (line 43)
Value to differentiate must be a traced dlarray scalar.
Error in gradtest (line 7)
[fval,gradval,dd] = dlfeval(@Myfunc,x0,y);
-----------------------------------------------------------------------------------------------------------------------
Thanks for reading my question.
댓글 수: 2
Walter Roberson
2021년 2월 16일
What is the difference between this and https://www.mathworks.com/matlabcentral/answers/745857-how-higher-derivative-by-dlgradient-or-higher-derivative-in-matlab?s_tid=srchtitle and https://www.mathworks.com/matlabcentral/answers/746512-how-higher-derivative-by-dlgradient-or-higher-derivative-in-matlab?s_tid=srchtitle ?
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!