XCSF
1.4.7
XCSF learning classifier system
|
An implementation of a 2D convolutional layer. More...
#include "neural_layer.h"
Go to the source code of this file.
Functions | |
void | neural_layer_convolutional_init (struct Layer *l, const struct ArgsLayer *args) |
Initialises a 2D convolutional layer. More... | |
struct Layer * | neural_layer_convolutional_copy (const struct Layer *src) |
Initialises and copies one convolutional layer from another. More... | |
void | neural_layer_convolutional_rand (struct Layer *l) |
Randomises the weights of a convolutional layer. More... | |
void | neural_layer_convolutional_forward (const struct Layer *l, const struct Net *net, const double *input) |
Forward propagates a convolutional layer. More... | |
void | neural_layer_convolutional_backward (const struct Layer *l, const struct Net *net, const double *input, double *delta) |
Backward propagates a convolutional layer. More... | |
void | neural_layer_convolutional_update (const struct Layer *l) |
Updates the weights and biases of a convolutional layer. More... | |
void | neural_layer_convolutional_print (const struct Layer *l, const bool print_weights) |
Prints a convolutional layer. More... | |
bool | neural_layer_convolutional_mutate (struct Layer *l) |
Mutates a convolutional layer. More... | |
void | neural_layer_convolutional_free (const struct Layer *l) |
Free memory used by a convolutional layer. More... | |
double * | neural_layer_convolutional_output (const struct Layer *l) |
Returns the output from a convolutional layer. More... | |
size_t | neural_layer_convolutional_save (const struct Layer *l, FILE *fp) |
Writes a convolutional layer to a file. More... | |
size_t | neural_layer_convolutional_load (struct Layer *l, FILE *fp) |
Reads a convolutional layer from a file. More... | |
void | neural_layer_convolutional_resize (struct Layer *l, const struct Layer *prev) |
Resizes a convolutional layer if the previous layer has changed size. More... | |
char * | neural_layer_convolutional_json_export (const struct Layer *l, const bool return_weights) |
Returns a json formatted string of a convolutional layer. More... | |
Variables | |
static struct LayerVtbl const | layer_convolutional_vtbl |
Neural convolutional layer implemented functions. More... | |
An implementation of a 2D convolutional layer.
Definition in file neural_layer_convolutional.h.
void neural_layer_convolutional_backward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input, | ||
double * | delta | ||
) |
Backward propagates a convolutional 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 296 of file neural_layer_convolutional.c.
References Layer::bias_updates, blas_gemm(), blas_sum(), Layer::c, Layer::channels, col2im(), Layer::delta, Layer::function, Layer::height, Layer::i, im2col(), LAYER_SGD_WEIGHTS, Layer::n_biases, Layer::n_filters, Layer::n_outputs, neural_gradient_array(), Layer::options, Layer::out_h, Layer::out_w, Layer::pad, Layer::size, Layer::state, Layer::stride, Layer::temp, Layer::weight_updates, Layer::weights, and Layer::width.
Initialises and copies one convolutional layer from another.
[in] | src | The source layer. |
Definition at line 203 of file neural_layer_convolutional.c.
References Layer::biases, Layer::channels, CONVOLUTIONAL, Layer::decay, Layer::eta, Layer::eta_max, Layer::eta_min, Layer::function, Layer::height, layer_defaults(), Layer::layer_vptr, malloc_layer_arrays(), Layer::max_neuron_grow, Layer::max_outputs, Layer::momentum, Layer::mu, Layer::n_active, Layer::n_biases, Layer::n_filters, Layer::n_inputs, N_MU, Layer::n_outputs, Layer::n_weights, Layer::options, Layer::out_c, Layer::out_h, Layer::out_w, Layer::pad, Layer::size, Layer::stride, Layer::type, Layer::weight_active, Layer::weights, and Layer::width.
void neural_layer_convolutional_forward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input | ||
) |
Forward propagates a convolutional layer.
[in] | l | Layer to forward propagate. |
[in] | net | Network containing the layer. |
[in] | input | The input to the layer. |
Definition at line 262 of file neural_layer_convolutional.c.
References Layer::biases, blas_gemm(), Layer::c, Layer::channels, Layer::function, Layer::height, Layer::i, im2col(), Layer::n_biases, Layer::n_filters, Layer::n_outputs, neural_activate_array(), Layer::out_h, Layer::out_w, Layer::output, Layer::pad, Layer::size, Layer::state, Layer::stride, Layer::temp, Layer::weights, and Layer::width.
void neural_layer_convolutional_free | ( | const struct Layer * | l | ) |
Free memory used by a convolutional layer.
[in] | l | The layer to be freed. |
Definition at line 142 of file neural_layer_convolutional.c.
References Layer::bias_updates, Layer::biases, Layer::delta, Layer::mu, Layer::output, Layer::state, Layer::temp, Layer::weight_active, Layer::weight_updates, and Layer::weights.
Initialises a 2D convolutional layer.
[in] | l | Layer to initialise. |
[in] | args | Parameters to initialise the layer. |
Definition at line 162 of file neural_layer_convolutional.c.
References Layer::biases, Layer::channels, ArgsLayer::channels, Layer::decay, ArgsLayer::decay, ArgsLayer::eta, Layer::eta_max, Layer::eta_min, ArgsLayer::eta_min, Layer::function, ArgsLayer::function, get_out_height(), get_out_width(), Layer::height, ArgsLayer::height, layer_args_opt(), layer_init_eta(), malloc_layer_arrays(), Layer::max_neuron_grow, ArgsLayer::max_neuron_grow, Layer::max_outputs, Layer::momentum, ArgsLayer::momentum, Layer::mu, MU_TYPE, Layer::n_active, Layer::n_biases, Layer::n_filters, ArgsLayer::n_init, Layer::n_inputs, ArgsLayer::n_max, N_MU, Layer::n_outputs, Layer::n_weights, Layer::options, Layer::out_c, Layer::out_h, Layer::out_w, Layer::pad, ArgsLayer::pad, rand_normal(), sam_init(), Layer::size, ArgsLayer::size, Layer::stride, ArgsLayer::stride, Layer::weight_active, WEIGHT_SD_INIT, Layer::weights, Layer::width, and ArgsLayer::width.
char* neural_layer_convolutional_json_export | ( | const struct Layer * | l, |
const bool | return_weights | ||
) |
Returns a json formatted string of a convolutional layer.
[in] | l | The layer to return. |
[in] | return_weights | Whether to return the values of weights and biases. |
Definition at line 514 of file neural_layer_convolutional.c.
References Layer::eta, Layer::function, layer_weight_json(), Layer::mu, Layer::n_filters, Layer::n_inputs, N_MU, Layer::n_outputs, neural_activation_string(), Layer::pad, Layer::size, Layer::stride, and Layer::weights.
Referenced by neural_layer_convolutional_print().
size_t neural_layer_convolutional_load | ( | struct Layer * | l, |
FILE * | fp | ||
) |
Reads a convolutional layer from a file.
[in] | l | The layer to load. |
[in] | fp | Pointer to the file to be read. |
Definition at line 589 of file neural_layer_convolutional.c.
References Layer::bias_updates, Layer::biases, Layer::channels, Layer::decay, Layer::eta, Layer::eta_max, Layer::eta_min, Layer::function, Layer::height, malloc_layer_arrays(), Layer::max_neuron_grow, Layer::max_outputs, Layer::momentum, Layer::mu, Layer::n_active, Layer::n_biases, Layer::n_filters, Layer::n_inputs, N_MU, Layer::n_outputs, Layer::n_weights, Layer::options, Layer::out_c, Layer::out_h, Layer::out_w, Layer::pad, Layer::size, Layer::stride, Layer::weight_active, Layer::weight_updates, Layer::weights, and Layer::width.
bool neural_layer_convolutional_mutate | ( | struct Layer * | l | ) |
Mutates a convolutional layer.
[in] | l | The layer to mutate. |
Definition at line 452 of file neural_layer_convolutional.c.
References LAYER_EVOLVE_CONNECT, LAYER_EVOLVE_ETA, LAYER_EVOLVE_FUNCTIONS, LAYER_EVOLVE_NEURONS, LAYER_EVOLVE_WEIGHTS, layer_mutate_connectivity(), layer_mutate_eta(), layer_mutate_functions(), layer_mutate_weights(), Layer::mu, MU_TYPE, N_MU, neural_layer_convolutional_add_filters(), neural_layer_convolutional_mutate_filter(), Layer::options, and sam_adapt().
double* neural_layer_convolutional_output | ( | const struct Layer * | l | ) |
Returns the output from a convolutional layer.
[in] | l | The layer whose output to return. |
Definition at line 487 of file neural_layer_convolutional.c.
References Layer::output.
void neural_layer_convolutional_print | ( | const struct Layer * | l, |
const bool | print_weights | ||
) |
Prints a convolutional layer.
[in] | l | The layer to print. |
[in] | print_weights | Whether to print the values of weights and biases. |
Definition at line 498 of file neural_layer_convolutional.c.
References neural_layer_convolutional_json_export().
void neural_layer_convolutional_rand | ( | struct Layer * | l | ) |
Randomises the weights of a convolutional layer.
[in] | l | The layer to randomise. |
Definition at line 250 of file neural_layer_convolutional.c.
References layer_weight_rand().
Resizes a convolutional 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 361 of file neural_layer_convolutional.c.
References Layer::channels, Layer::delta, get_out_height(), get_out_width(), Layer::height, Layer::i, layer_calc_n_active(), Layer::n_filters, Layer::n_inputs, Layer::n_outputs, Layer::n_weights, Layer::out_c, Layer::out_h, Layer::out_w, Layer::output, rand_normal(), realloc_layer_arrays(), Layer::size, Layer::state, Layer::weight_active, WEIGHT_SD, Layer::weight_updates, Layer::weights, and Layer::width.
size_t neural_layer_convolutional_save | ( | const struct Layer * | l, |
FILE * | fp | ||
) |
Writes a convolutional layer to a file.
[in] | l | The layer to save. |
[in] | fp | Pointer to the file to be written. |
Definition at line 546 of file neural_layer_convolutional.c.
References Layer::bias_updates, Layer::biases, Layer::channels, Layer::decay, Layer::eta, Layer::eta_max, Layer::eta_min, Layer::function, Layer::height, Layer::max_neuron_grow, Layer::max_outputs, Layer::momentum, Layer::mu, Layer::n_active, Layer::n_biases, Layer::n_filters, Layer::n_inputs, N_MU, Layer::n_outputs, Layer::n_weights, Layer::options, Layer::out_c, Layer::out_h, Layer::out_w, Layer::pad, Layer::size, Layer::stride, Layer::weight_active, Layer::weight_updates, Layer::weights, and Layer::width.
void neural_layer_convolutional_update | ( | const struct Layer * | l | ) |
Updates the weights and biases of a convolutional layer.
[in] | l | The layer to update. |
Definition at line 340 of file neural_layer_convolutional.c.
References Layer::bias_updates, Layer::biases, blas_axpy(), blas_scal(), Layer::decay, Layer::eta, LAYER_SGD_WEIGHTS, layer_weight_clamp(), Layer::momentum, Layer::n_biases, Layer::n_weights, Layer::options, Layer::weight_updates, and Layer::weights.
|
static |
Neural convolutional layer implemented functions.
Definition at line 72 of file neural_layer_convolutional.h.
Referenced by layer_set_vptr().