diff options
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 + |