diff options
author | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 08:14:45 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 08:14:45 +0800 |
commit | cccccbf6cca94a3eaf813b4468453160e91c332b (patch) | |
tree | 23418cb73a10ae3b0688681a7f0ba9b06424583e /src/CuTNetLib/cuActivation.cc | |
download | tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.tar.gz tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.tar.bz2 tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.zip |
First commit
Diffstat (limited to 'src/CuTNetLib/cuActivation.cc')
-rw-r--r-- | src/CuTNetLib/cuActivation.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/CuTNetLib/cuActivation.cc b/src/CuTNetLib/cuActivation.cc new file mode 100644 index 0000000..bd57ae5 --- /dev/null +++ b/src/CuTNetLib/cuActivation.cc @@ -0,0 +1,46 @@ + +#include "cuActivation.h" +#include "cumath.h" + + +namespace TNet { + + + void + CuSigmoid:: + PropagateFnc(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) + { + CuMath<BaseFloat>::Sigmoid(Y, X); + } + + + void + CuSigmoid:: + BackpropagateFnc(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) + { + CuMath<BaseFloat>::DiffSigmoid(Y, X, mOutput); + } + + + + void + CuSoftmax:: + PropagateFnc(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) + { + CuMath<BaseFloat>::Softmax(Y,X); + } + + + + void + CuSoftmax:: + BackpropagateFnc(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) + { + //we assume X is already dE/dSoftmax_input + Y.CopyFrom(X); + } + + + +} //namespace + |