#include <Stack.h>
|
| virtual VectorXd | compute (const VectorXd &) const override |
Definition at line 100 of file Stack.h.
◆ compute()
| VectorXd lwtDev::SoftmaxLayer::compute |
( |
const VectorXd & | in | ) |
const |
|
overridevirtual |
Implements lwtDev::ILayer.
Definition at line 182 of file Stack.cxx.
182 {
183
184
185 size_t n_elements = in.rows();
186 VectorXd
exp(n_elements);
187 double max = in.maxCoeff();
188 for (size_t iii = 0; iii < n_elements; iii++) {
189 exp(iii) = std::exp(in(iii) -
max);
190 }
191 double sum_exp =
exp.sum();
192 return exp / sum_exp;
193 }
The documentation for this class was generated from the following files: