XCSF
1.4.7
XCSF learning classifier system
|
An implementation of an average pooling layer. More...
Go to the source code of this file.
Functions | |
static void | malloc_layer_arrays (struct Layer *l) |
Allocate memory used by an average pooling layer. More... | |
static void | realloc_layer_arrays (struct Layer *l) |
Resize memory used by an average pooling layer. More... | |
void | neural_layer_avgpool_free (const struct Layer *l) |
Free memory used by an average pooling layer. More... | |
void | neural_layer_avgpool_init (struct Layer *l, const struct ArgsLayer *args) |
Initialises an average pooling layer. More... | |
struct Layer * | neural_layer_avgpool_copy (const struct Layer *src) |
Initialises and copies one average pooling layer from another. More... | |
void | neural_layer_avgpool_rand (struct Layer *l) |
Dummy function since average pooling layers have no weights. More... | |
void | neural_layer_avgpool_forward (const struct Layer *l, const struct Net *net, const double *input) |
Forward propagates an average pooling layer. More... | |
void | neural_layer_avgpool_backward (const struct Layer *l, const struct Net *net, const double *input, double *delta) |
Backward propagates an average pooling layer. More... | |
void | neural_layer_avgpool_update (const struct Layer *l) |
Dummy function since average pooling layers have no weights. More... | |
bool | neural_layer_avgpool_mutate (struct Layer *l) |
Dummy function since average pooling layers cannot be mutated. More... | |
void | neural_layer_avgpool_resize (struct Layer *l, const struct Layer *prev) |
Resizes an avg pooling layer if the previous layer has changed size. More... | |
double * | neural_layer_avgpool_output (const struct Layer *l) |
Returns the output from an average pooling layer. More... | |
void | neural_layer_avgpool_print (const struct Layer *l, const bool print_weights) |
Prints an average pooling layer. More... | |
char * | neural_layer_avgpool_json_export (const struct Layer *l, const bool return_weights) |
Returns a json formatted string of an average pool layer. More... | |
size_t | neural_layer_avgpool_save (const struct Layer *l, FILE *fp) |
Writes an average pooling layer to a file. More... | |
size_t | neural_layer_avgpool_load (struct Layer *l, FILE *fp) |
Reads an average pooling layer from a file. More... | |
An implementation of an average pooling layer.
Definition in file neural_layer_avgpool.c.
|
static |
Allocate memory used by an average pooling layer.
[in] | l | The layer to be allocated memory. |
Definition at line 33 of file neural_layer_avgpool.c.
References Layer::delta, layer_guard_outputs(), Layer::n_outputs, and Layer::output.
Referenced by neural_layer_avgpool_copy(), neural_layer_avgpool_init(), and neural_layer_avgpool_load().
void neural_layer_avgpool_backward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input, | ||
double * | delta | ||
) |
Backward propagates an average pooling 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 151 of file neural_layer_avgpool.c.
References Layer::channels, Layer::delta, Layer::height, Layer::i, and Layer::width.
Initialises and copies one average pooling layer from another.
[in] | src | The source layer. |
Definition at line 89 of file neural_layer_avgpool.c.
References AVGPOOL, Layer::channels, Layer::height, 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::type, and Layer::width.
void neural_layer_avgpool_forward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input | ||
) |
Forward propagates an average pooling layer.
[in] | l | Layer to forward propagate. |
[in] | net | Network containing the layer. |
[in] | input | Input to the layer. |
Definition at line 129 of file neural_layer_avgpool.c.
References Layer::channels, Layer::height, Layer::i, Layer::output, and Layer::width.
void neural_layer_avgpool_free | ( | const struct Layer * | l | ) |
Free memory used by an average pooling layer.
[in] | l | The layer to be freed. |
Definition at line 57 of file neural_layer_avgpool.c.
References Layer::delta, and Layer::output.
Initialises an average pooling layer.
[in] | l | Layer to initialise. |
[in] | args | Parameters to initialise the layer. |
Definition at line 69 of file neural_layer_avgpool.c.
References Layer::channels, ArgsLayer::channels, Layer::height, ArgsLayer::height, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::width, and ArgsLayer::width.
char* neural_layer_avgpool_json_export | ( | const struct Layer * | l, |
const bool | return_weights | ||
) |
Returns a json formatted string of an average pool layer.
[in] | l | The layer to return. |
[in] | return_weights | Whether to return the values of weights and biases. |
Definition at line 241 of file neural_layer_avgpool.c.
References Layer::channels, Layer::height, Layer::n_inputs, Layer::n_outputs, and Layer::width.
Referenced by neural_layer_avgpool_print().
size_t neural_layer_avgpool_load | ( | struct Layer * | l, |
FILE * | fp | ||
) |
Reads an average pooling layer from a file.
[in] | l | The layer to load. |
[in] | fp | Pointer to the file to be read. |
Definition at line 286 of file neural_layer_avgpool.c.
References Layer::channels, Layer::height, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, and Layer::width.
bool neural_layer_avgpool_mutate | ( | struct Layer * | l | ) |
Dummy function since average pooling layers cannot be mutated.
[in] | l | An average pooling layer. |
Definition at line 182 of file neural_layer_avgpool.c.
double* neural_layer_avgpool_output | ( | const struct Layer * | l | ) |
Returns the output from an average pooling layer.
[in] | l | The layer whose output to return. |
Definition at line 215 of file neural_layer_avgpool.c.
References Layer::output.
void neural_layer_avgpool_print | ( | const struct Layer * | l, |
const bool | print_weights | ||
) |
Prints an average pooling layer.
[in] | l | The layer to print. |
[in] | print_weights | Whether to print the values of weights and biases. |
Definition at line 226 of file neural_layer_avgpool.c.
References neural_layer_avgpool_json_export().
void neural_layer_avgpool_rand | ( | struct Layer * | l | ) |
Dummy function since average pooling layers have no weights.
[in] | l | An average pooling layer. |
Definition at line 117 of file neural_layer_avgpool.c.
Resizes an avg pooling 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 194 of file neural_layer_avgpool.c.
References Layer::c, Layer::channels, Layer::h, Layer::height, Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, realloc_layer_arrays(), and Layer::width.
size_t neural_layer_avgpool_save | ( | const struct Layer * | l, |
FILE * | fp | ||
) |
Writes an average pooling layer to a file.
[in] | l | The layer to save. |
[in] | fp | Pointer to the file to be written. |
Definition at line 264 of file neural_layer_avgpool.c.
References Layer::channels, Layer::height, Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, and Layer::width.
void neural_layer_avgpool_update | ( | const struct Layer * | l | ) |
Dummy function since average pooling layers have no weights.
[in] | l | An average pooling layer. |
Definition at line 171 of file neural_layer_avgpool.c.
|
static |
Resize memory used by an average pooling layer.
[in] | l | The layer to be allocated memory. |
Definition at line 45 of file neural_layer_avgpool.c.
References Layer::delta, layer_guard_outputs(), Layer::n_outputs, and Layer::output.
Referenced by neural_layer_avgpool_resize().