143 {
144
145 if (activation == "sigmoid") {
146 activation_function = neural_network::activations::sigmoid;
147 dactivation_function = neural_network::activations::sigmoid;
148 } else if (activation == "relu") {
149 activation_function = neural_network::activations::relu;
150 dactivation_function = neural_network::activations::drelu;
151 } else if (activation == "tanh") {
152 activation_function = neural_network::activations::tanh;
153 dactivation_function = neural_network::activations::dtanh;
154 } else if (activation == "none") {
155
156 activation_function =
157 neural_network::util_functions::identity_function;
158 dactivation_function =
159 neural_network::util_functions::identity_function;
160 } else {
161
162 std::cerr <<
"ERROR (" << __func__ <<
") : ";
163 std::cerr <<
"Invalid argument. Expected {none, sigmoid, relu, "
164 "tanh} got ";
167 }
168 this->activation = activation;
169 this->neurons = neurons;
170
171 if (random_kernel) {
173 } else {
175 }
176 }
void unit_matrix_initialization(std::vector< std::valarray< T > > &A, const std::pair< size_t, size_t > &shape)
Definition vector_ops.hpp:193
void uniform_random_initialization(std::vector< std::valarray< T > > &A, const std::pair< size_t, size_t > &shape, const T &low, const T &high)
Definition vector_ops.hpp:166