XCSF
1.4.7
XCSF learning classifier system
|
An implementation of a dropout layer. More...
#include "neural_layer.h"
Go to the source code of this file.
Functions | |
void | neural_layer_dropout_init (struct Layer *l, const struct ArgsLayer *args) |
Initialises a dropout layer. More... | |
struct Layer * | neural_layer_dropout_copy (const struct Layer *src) |
Initialises and creates a copy of one dropout layer from another. More... | |
void | neural_layer_dropout_rand (struct Layer *l) |
Dummy function since dropout layers have no weights. More... | |
void | neural_layer_dropout_forward (const struct Layer *l, const struct Net *net, const double *input) |
Forward propagates a dropout layer. More... | |
void | neural_layer_dropout_backward (const struct Layer *l, const struct Net *net, const double *input, double *delta) |
Backward propagates a dropout layer. More... | |
void | neural_layer_dropout_update (const struct Layer *l) |
Dummy function since a dropout layer has no weights. More... | |
void | neural_layer_dropout_print (const struct Layer *l, const bool print_weights) |
Prints a dropout layer. More... | |
bool | neural_layer_dropout_mutate (struct Layer *l) |
Dummy function since a dropout layer cannot be mutated. More... | |
void | neural_layer_dropout_free (const struct Layer *l) |
Free memory used by a dropout layer. More... | |
double * | neural_layer_dropout_output (const struct Layer *l) |
Returns the output from a dropout layer. More... | |
size_t | neural_layer_dropout_save (const struct Layer *l, FILE *fp) |
Writes a dropout layer to a file. More... | |
size_t | neural_layer_dropout_load (struct Layer *l, FILE *fp) |
Reads a dropout layer from a file. More... | |
void | neural_layer_dropout_resize (struct Layer *l, const struct Layer *prev) |
Resizes a dropout layer if the previous layer has changed size. More... | |
char * | neural_layer_dropout_json_export (const struct Layer *l, const bool return_weights) |
Returns a json formatted string representation of a dropout layer. More... | |
Variables | |
static struct LayerVtbl const | layer_dropout_vtbl |
Neural dropout layer implemented functions. More... | |
An implementation of a dropout layer.
Definition in file neural_layer_dropout.h.
void neural_layer_dropout_backward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input, | ||
double * | delta | ||
) |
Backward propagates a dropout layer.
[in] | l | The layer to backward propagate. |
[in] | net | Network containing the layer. |
[in] | input | The input to the layer. |
[out] | delta | The previous layer's error. |
Definition at line 152 of file neural_layer_dropout.c.
References Layer::delta, Layer::i, Layer::n_inputs, Layer::probability, Layer::scale, and Layer::state.
Initialises and creates a copy of one dropout layer from another.
[in] | src | The source layer. |
Definition at line 88 of file neural_layer_dropout.c.
References DROPOUT, layer_defaults(), Layer::layer_vptr, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::probability, Layer::scale, and Layer::type.
void neural_layer_dropout_forward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input | ||
) |
Forward propagates a dropout layer.
[in] | l | Layer to forward propagate. |
[in] | net | Network containing the layer. |
[in] | input | Input to the layer. |
Definition at line 127 of file neural_layer_dropout.c.
References Layer::i, Layer::n_inputs, Layer::output, Layer::probability, rand_uniform(), Layer::scale, Layer::state, and Net::train.
void neural_layer_dropout_free | ( | const struct Layer * | l | ) |
Free memory used by a dropout layer.
[in] | l | The layer to be freed. |
Definition at line 77 of file neural_layer_dropout.c.
References free_layer_arrays().
Initialises a dropout layer.
[in] | l | Layer to initialise. |
[in] | args | Parameters to initialise the layer. |
Definition at line 59 of file neural_layer_dropout.c.
References ArgsLayer::channels, ArgsLayer::height, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, ArgsLayer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::probability, ArgsLayer::probability, Layer::scale, and ArgsLayer::width.
char* neural_layer_dropout_json_export | ( | const struct Layer * | l, |
const bool | return_weights | ||
) |
Returns a json formatted string representation of a dropout layer.
[in] | l | The layer to return. |
[in] | return_weights | Whether to return the values of weights and biases. |
Definition at line 240 of file neural_layer_dropout.c.
References Layer::n_inputs, Layer::n_outputs, and Layer::probability.
Referenced by neural_layer_dropout_print().
size_t neural_layer_dropout_load | ( | struct Layer * | l, |
FILE * | fp | ||
) |
Reads a dropout layer from a file.
[in] | l | The layer to load. |
[in] | fp | Pointer to the file to be read. |
Definition at line 282 of file neural_layer_dropout.c.
References malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::probability, and Layer::scale.
bool neural_layer_dropout_mutate | ( | struct Layer * | l | ) |
Dummy function since a dropout layer cannot be mutated.
[in] | l | A dropout layer. |
Definition at line 184 of file neural_layer_dropout.c.
double* neural_layer_dropout_output | ( | const struct Layer * | l | ) |
Returns the output from a dropout layer.
[in] | l | The layer whose output to return. |
Definition at line 214 of file neural_layer_dropout.c.
References Layer::output.
void neural_layer_dropout_print | ( | const struct Layer * | l, |
const bool | print_weights | ||
) |
Prints a dropout layer.
[in] | l | The layer to print. |
[in] | print_weights | Whether to print the values of weights and biases. |
Definition at line 225 of file neural_layer_dropout.c.
References neural_layer_dropout_json_export().
void neural_layer_dropout_rand | ( | struct Layer * | l | ) |
Dummy function since dropout layers have no weights.
[in] | l | A dropout layer. |
Definition at line 115 of file neural_layer_dropout.c.
Resizes a dropout layer if the previous layer has changed size.
[in] | l | The layer to resize. |
[in] | prev | The layer previous to the one being resized. |
Definition at line 196 of file neural_layer_dropout.c.
References free_layer_arrays(), malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, and Layer::out_w.
size_t neural_layer_dropout_save | ( | const struct Layer * | l, |
FILE * | fp | ||
) |
Writes a dropout layer to a file.
[in] | l | The layer to save. |
[in] | fp | Pointer to the file to be written. |
Definition at line 261 of file neural_layer_dropout.c.
References Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::probability, and Layer::scale.
void neural_layer_dropout_update | ( | const struct Layer * | l | ) |
Dummy function since a dropout layer has no weights.
[in] | l | A dropout layer. |
Definition at line 173 of file neural_layer_dropout.c.
|
static |
Neural dropout layer implemented functions.
Definition at line 70 of file neural_layer_dropout.h.
Referenced by layer_set_vptr().