Saving Multiples Variable of a function

1 visualización (últimos 30 días)
yoel y
yoel y el 22 de Oct. de 2020
Respondida: Asad (Mehrzad) Khoddam el 22 de Oct. de 2020
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 comentario
yoel y
yoel y el 22 de Oct. de 2020
for uppdating the parameters, it will be like this
W1 = W1 + αdW1
and it also apply for other variables

Iniciar sesión para comentar.

Respuesta aceptada

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam el 22 de Oct. de 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

Más respuestas (0)

Categorías

Más información sobre Sparse Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by