Saving Multiples Variable of a function

조회 수: 1 (최근 30일)
yoel y
yoel y . 2020년 10월 22일
답변: Asad (Mehrzad) Khoddam . 2020년 10월 22일
I have some codes that i make
function result = back_prop(W1,W2,W3, A1,A2,A3, T_Input, Output)
dim_A = size(T_Input)
m = dim_A(2)
dZ3 = A3 - Output.'
dW3 = 1/m * dot_mult_dif_dim(dZ3, A2.')
db3 = 1/m * np_sum(dZ3)
dZ2 = dot_mult_dif_dim(W3.', dZ3).*(1 - A2.^2)
dW2 = 1/m * dot_mult_dif_dim(dZ2, A1.')
db2 = 1/m * np_sum(dZ2)
dZ1 = dot_mult_dif_dim(W2.', dZ2).*(1 - A1.^2)
dW1 = 1/m * dot_mult_dif_dim(dZ1, T_Input.')
db1 = 1/m * np_sum(dZ1)
where dot_mult_dif_dim and np_sum is a function that i make my own,
how can i save or access dZ3, dW3, db3, dZ2, dW2, db2, dZ1, dW1, and db1 ? each of them are matrix
i want to use them to update some parameters in NN, thank you
  댓글 수: 1
yoel y
yoel y 2020년 10월 22일
for uppdating the parameters, it will be like this
W1 = W1 + αdW1
and it also apply for other variables

댓글을 달려면 로그인하십시오.

채택된 답변

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020년 10월 22일
If you want to use the variables in the other function, use this command in both functions:
global dZ3 dW3 db3 dZ2 dW2 db2 dZ1 dW1 db1

추가 답변 (0개)


Help CenterFile Exchange에서 Specialized Power Systems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by