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/CuTNetLib/cuActivation.cc | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/CuTNetLib/cuActivation.cc (limited to 'src/CuTNetLib/cuActivation.cc') 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& X, CuMatrix& Y) + { + CuMath::Sigmoid(Y, X); + } + + + void + CuSigmoid:: + BackpropagateFnc(const CuMatrix& X, CuMatrix& Y) + { + CuMath::DiffSigmoid(Y, X, mOutput); + } + + + + void + CuSoftmax:: + PropagateFnc(const CuMatrix& X, CuMatrix& Y) + { + CuMath::Softmax(Y,X); + } + + + + void + CuSoftmax:: + BackpropagateFnc(const CuMatrix& X, CuMatrix& Y) + { + //we assume X is already dE/dSoftmax_input + Y.CopyFrom(X); + } + + + +} //namespace + -- cgit v1.2.3-70-g09d2