Saving Multiples Variable of a function

1 次查看(过去 30 天)
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 个评论
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
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 中查找有关 Sparse Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by