提交 160d91fd 编写于 作者: sahduashufa's avatar sahduashufa

add the xmind

上级 a7dc3e84
无法预览此类型文件
此差异已折叠。
...@@ -84,7 +84,7 @@ struct edge_network ...@@ -84,7 +84,7 @@ struct edge_network
cout_mat(mul_simple(mul(weights,grad_next),output_before)); cout_mat(mul_simple(mul(weights,grad_next),output_before));
return mul_simple(mul(weights,grad_next),output_before); return mul_simple(mul(weights,grad_next),output_before);
} }
Matrix end_layer_backward(Matrix label,Matrix acti_val,Node loss_fun(Node,Node),Node act(Node)) Matrix end_layer_backward(Matrix label,Matrix acti_val,Node loss_fun(Node,Node),Node act_fun(Node))
{ {
Matrix loss_act = CreateMatrix(acti_val.row,acti_val.col); Matrix loss_act = CreateMatrix(acti_val.row,acti_val.col);
Matrix act_output = CreateMatrix(acti_val.row,acti_val.col); Matrix act_output = CreateMatrix(acti_val.row,acti_val.col);
...@@ -96,20 +96,18 @@ struct edge_network ...@@ -96,20 +96,18 @@ struct edge_network
// cout<<"t1: "<<t1<<endl; // cout<<"t1: "<<t1<<endl;
Node a13 = 1/(1+(1/exp(z31))); Node a13 = 1/(1+(1/exp(z31)));
Node loss = loss_fun(t1,a13); Node loss = loss_fun(t1,a13);
Node act = 1/(1+(1/exp(z31))); Node act = act_fun(z31);
act_output.matrix[index_x][0] = act.gradient(z31); act_output.matrix[index_x][0] = act.gradient(z31);
loss_act.matrix[index_x][0] = loss.gradient(a13); loss_act.matrix[index_x][0] = loss.gradient(a13);
// cout<<"z31: "<<z31<<endl; cout<<"z31: "<<z31<<endl;
// cout<<"z31_grad: "<<act.gradient(z31)<<endl; cout<<"z31_grad: "<<act.gradient(z31)<<endl;
// cout<<"a13: "<<a13<<"t1: "<<t1<<endl; cout<<"a13: "<<a13<<"t1: "<<t1<<endl;
cout<<"loss: "<<loss<<endl; cout<<"loss: "<<loss<<endl;
// cout<<"a13_gradient: "<<loss.gradient(a13)<<endl; cout<<"a13_gradient: "<<loss.gradient(a13)<<endl;
} }
Matrix mid_grad_end = mul_simple(loss_act,act_output); Matrix mid_grad_end = mul_simple(loss_act,act_output);
cout<<"mid_grad_end";
// cout<<"mid_grad_end"; cout_mat(mid_grad_end);
// cout_mat(mid_grad_end);
return mid_grad_end; return mid_grad_end;
} }
}; };
......
无法预览此类型文件
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <math.h> #include <math.h>
#include <fstream> #include <fstream>
#include "./autodiff/node.h" #include "./autodiff/node.h"
#include"./matrix/matrix_def.h" #include"./matrix/matrix_def.h"a
#include"./matrix/matrix_pro.h" #include"./matrix/matrix_pro.h"
#include"./welcome/score_wel.cpp" #include"./welcome/score_wel.cpp"
#include"./logistic/logistic_def.h" #include"./logistic/logistic_def.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册