blob: bd57ae5be499e6d85a655e3d8d5f0ec6eec9af69 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
 |