Stan Math Library
4.9.0
Automatic Differentiation
|
|
inline |
Return the natural logarithm of the softmax of the specified vector.
\( \log \mbox{softmax}(y) \ = \ y - \log \sum_{k=1}^K \exp(y_k) \ = \ y - \mbox{log\_sum\_exp}(y). \)
For the log softmax function, the entries in the Jacobian are \( \frac{\partial}{\partial y_m} \mbox{softmax}(y)[k] = \left\{ \begin{array}{ll} 1 - \mbox{softmax}(y)[m] & \mbox{ if } m = k, \mbox{ and} \\[6pt] \mbox{softmax}(y)[m] & \mbox{ if } m \neq k. \end{array} \right. \)
Container | type of input vector to transform |
[in] | x | vector to transform |
Definition at line 44 of file log_softmax.hpp.