|
|
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 |
155 if (activation ==
"sigmoid") {
156 activation_function = neural_network::activations::sigmoid;
157 dactivation_function = neural_network::activations::sigmoid;
159 else if (activation ==
"relu") {
160 activation_function = neural_network::activations::relu;
161 dactivation_function = neural_network::activations::drelu;
163 else if (activation ==
"tanh") {
164 activation_function = neural_network::activations::tanh;
165 dactivation_function = neural_network::activations::dtanh;
167 else if (activation ==
"none") {
169 activation_function = neural_network::util_functions::identity_function;
170 dactivation_function = neural_network::util_functions::identity_function;
174 std::cerr <<
"ERROR: Invalid argument for layer -> constructor -> activation, ";
175 std::cerr <<
"Expected from {none, sigmoid, relu, tanh} got ";
179 this -> activation = activation;
180 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) |
199 if (activation ==
"sigmoid") {
200 activation_function = neural_network::activations::sigmoid;
201 dactivation_function = neural_network::activations::sigmoid;
203 else if (activation ==
"relu") {
204 activation_function = neural_network::activations::relu;
205 dactivation_function = neural_network::activations::drelu;
207 else if (activation ==
"tanh") {
208 activation_function = neural_network::activations::tanh;
209 dactivation_function = neural_network::activations::dtanh;
211 else if (activation ==
"none") {
213 activation_function = neural_network::util_functions::identity_function;
214 dactivation_function = neural_network::util_functions::identity_function;
218 std::cerr <<
"ERROR: Invalid argument for layer -> constructor -> activation, ";
219 std::cerr <<
"Expected from {none, sigmoid, relu, tanh} got ";
223 this -> activation = activation;
224 this -> neurons = neurons;
225 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: