@@ -21,39 +21,39 @@ namespace paddle {
21
21
22
22
class LinearChainCRF {
23
23
public:
24
- /*
25
- The size of para and grad must be (numClasses + 2) * numClasses.
26
- The first numClasses values of para are for starting weights (a ).
27
- The next numClasses values of para are for ending weights (b ),
28
- The remaning values are for transition weights (w ).
29
-
30
- The probability of a state sequence s of length L is defined as:
31
- P(s) = (1/Z) exp(a_{s_1} + b_{s_L}
32
- + \sum_{l=1}^L x_{s_l}
33
- + \sum_{l=2}^L w_{s_{l-1},s_l})
34
- where Z is a normalization value so that the sum of P(s) over all possible
35
- sequences is 1 , and x is the input feature to the CRF.
24
+ /* *
25
+ * The size of para and grad must be \f$ (numClasses + 2) * numClasses\f$ .
26
+ * The first numClasses values of para are for starting weights (\f$a\f$ ).
27
+ * The next numClasses values of para are for ending weights (\f$b\f$ ),
28
+ * The remaning values are for transition weights (\f$w\f$ ).
29
+ *
30
+ * The probability of a state sequence s of length \f$L\f$ is defined as:
31
+ * \f$ P(s) = (1/Z) exp(a_{s_1} + b_{s_L}
32
+ * + \sum_{l=1}^L x_{s_l}
33
+ * + \sum_{l=2}^L w_{s_{l-1},s_l})\f$
34
+ * where \f$Z\f$ is a normalization value so that the sum of \f$ P(s)\f$ over all possible
35
+ * sequences is \f$1\f$ , and \f$x\f$ is the input feature to the CRF.
36
36
*/
37
37
LinearChainCRF (int numClasses, real* para, real* grad);
38
38
39
- /*
40
- Calculate the negative log likelihood of s given x.
41
- The size of x must be length * numClasses. Each consecutive numClasses
42
- values are the features for one time step.
39
+ /* *
40
+ * Calculate the negative log likelihood of s given x.
41
+ * The size of x must be length * numClasses. Each consecutive numClasses
42
+ * values are the features for one time step.
43
43
*/
44
44
real forward (real* x, int * s, int length);
45
45
46
- /*
47
- Calculate the gradient with respect to x, a, b, and w.
48
- The gradient of x will be stored in dx.
49
- backward() can only be called after a corresponding call to forward() with
50
- the same x, s and length.
51
- NOTE: The gradient is added to dx and grad (provided at constructor).
46
+ /* *
47
+ * Calculate the gradient with respect to x, a, b, and w.
48
+ * The gradient of x will be stored in dx.
49
+ * backward() can only be called after a corresponding call to forward() with
50
+ * the same x, s and length.
51
+ * @note The gradient is added to dx and grad (provided at constructor).
52
52
*/
53
53
void backward (real* x, real* dx, int * s, int length);
54
54
55
- /*
56
- Find the most probable sequence given x. The result will be stored in s.
55
+ /* *
56
+ * Find the most probable sequence given x. The result will be stored in s.
57
57
*/
58
58
void decode (real* x, int * s, int length);
59
59
0 commit comments