From cccccbf6cca94a3eaf813b4468453160e91c332b Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Mon, 14 Apr 2014 08:14:45 +0800 Subject: First commit --- src/TNetLib/Activation.cc | 138 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 src/TNetLib/Activation.cc (limited to 'src/TNetLib/Activation.cc') diff --git a/src/TNetLib/Activation.cc b/src/TNetLib/Activation.cc new file mode 100644 index 0000000..8e84190 --- /dev/null +++ b/src/TNetLib/Activation.cc @@ -0,0 +1,138 @@ + +#include "Activation.h" + + +namespace TNet { + +void Sigmoid::PropagateFnc(const BfMatrix& X, BfMatrix& Y) { + //Y = 1/(1+e^{-X}) + for(size_t r=0; r& X, Matrix& Y) { + const Matrix& out = GetOutput(); + //Y = OUT*(1-OUT)*X //ODVOZENO + for(size_t r=0; r> mDim; + mDimOffset.Init(mDim.Dim()+1); + + int off=0; + for(int i=0; i -0.1 && sum < 0.1) { + BfSubVector y_i_smx_j(Y[i].Range(mDimOffset[j],mDim[j])); + y_i_smx_j.Copy(x_i_smx_j); + } else if (sum > 0.9 && sum < 1.1) { + ; //do nothing + } else { + KALDI_ERR << "Invalid sum: " << sum; + } + } + } + +// X.CheckData("BlockSoftmax BackpropagateFnc X"); +// Y.CheckData("BlockSoftmax BackpropagateFnc Y"); + +} + + + +} //namespace TNet + -- cgit v1.2.3-70-g09d2