|
double(* | activation_function )(const double &) |
|
double(* | dactivation_function )(const double &) |
|
int | neurons |
|
std::string | activation |
|
std::vector< std::valarray< double > > | kernal |
|
neural_network::layers::DenseLayer class is used to store all necessary information about the layers (i.e. neurons, activation and kernal). This class is used by NeuralNetwork class to store layers.
◆ DenseLayer() [1/4]
machine_learning::neural_network::layers::DenseLayer::DenseLayer |
( |
const int & |
neurons, |
|
|
const std::string & |
activation, |
|
|
const std::pair< size_t, size_t > & |
kernal_shape, |
|
|
const bool & |
random_kernal |
|
) |
| |
|
inline |
Constructor for neural_network::layers::DenseLayer class
- Parameters
-
neurons | number of neurons |
activation | activation function for layer |
kernal_shape | shape of kernal |
random_kernal | flag for whether to intialize kernal randomly |
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") {
156 activation_function =
157 neural_network::util_functions::identity_function;
158 dactivation_function =
159 neural_network::util_functions::identity_function;
162 std::cerr <<
"ERROR (" << __func__ <<
") : ";
163 std::cerr <<
"Invalid argument. Expected {none, sigmoid, relu, "
168 this->activation = activation;
169 this->neurons = neurons;
◆ DenseLayer() [2/4]
Constructor for neural_network::layers::DenseLayer class
- Parameters
-
neurons | number of neurons |
activation | activation function for layer |
kernal | values of kernal (useful in loading model) |
186 if (activation ==
"sigmoid") {
187 activation_function = neural_network::activations::sigmoid;
188 dactivation_function = neural_network::activations::sigmoid;
189 }
else if (activation ==
"relu") {
190 activation_function = neural_network::activations::relu;
191 dactivation_function = neural_network::activations::drelu;
192 }
else if (activation ==
"tanh") {
193 activation_function = neural_network::activations::tanh;
194 dactivation_function = neural_network::activations::dtanh;
195 }
else if (activation ==
"none") {
197 activation_function =
198 neural_network::util_functions::identity_function;
199 dactivation_function =
200 neural_network::util_functions::identity_function;
203 std::cerr <<
"ERROR (" << __func__ <<
") : ";
204 std::cerr <<
"Invalid argument. Expected {none, sigmoid, relu, "
209 this->activation = activation;
210 this->neurons = neurons;
211 this->kernal = kernal;
◆ DenseLayer() [3/4]
machine_learning::neural_network::layers::DenseLayer::DenseLayer |
( |
const DenseLayer & |
layer | ) |
|
|
default |
Copy Constructor for class DenseLayer.
- Parameters
-
model | instance of class to be copied. |
◆ ~DenseLayer()
machine_learning::neural_network::layers::DenseLayer::~DenseLayer |
( |
| ) |
|
|
default |
◆ DenseLayer() [4/4]
machine_learning::neural_network::layers::DenseLayer::DenseLayer |
( |
DenseLayer && |
| ) |
|
|
default |
◆ operator=() [1/2]
DenseLayer& machine_learning::neural_network::layers::DenseLayer::operator= |
( |
const DenseLayer & |
layer | ) |
|
|
default |
◆ operator=() [2/2]
The documentation for this class was generated from the following file: