Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Higher order derivative by 'dlgradient'

2 ビュー (過去 30 日間)
jaehong kim
jaehong kim 2021 年 2 月 16 日
閉鎖済み: Walter Roberson 2021 年 2 月 18 日
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 件のコメント
jaehong kim
jaehong kim 2021 年 2 月 16 日
i am sorry...
I just posted to update the question. Sorry for violating the community rules. I'll be careful.

回答 (0 件)

この質問は閉じられています。

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by