Saving Multiples Variable of a function

1 visualizzazione (ultimi 30 giorni)
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)
end
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 Commento
yoel y
yoel y il 22 Ott 2020
for uppdating the parameters, it will be like this
W1 = W1 + αdW1
and it also apply for other variables

Accedi per commentare.

Risposta accettata

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam il 22 Ott 2020
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

Più risposte (0)

Categorie

Scopri di più su Sparse Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by