XCSF
1.4.7
XCSF learning classifier system
|
An implementation of a 2D upsampling layer. More...
Go to the source code of this file.
Functions | |
static void | malloc_layer_arrays (struct Layer *l) |
Allocate memory used by an upsampling layer. More... | |
static void | free_layer_arrays (const struct Layer *l) |
Free memory used by an upsampling layer. More... | |
void | neural_layer_upsample_free (const struct Layer *l) |
Free memory used by an upsampling layer. More... | |
void | neural_layer_upsample_init (struct Layer *l, const struct ArgsLayer *args) |
Initialises a 2D upsampling layer. More... | |
struct Layer * | neural_layer_upsample_copy (const struct Layer *src) |
Initialises and copies one upsampling layer from another. More... | |
void | neural_layer_upsample_rand (struct Layer *l) |
Dummy function since upsampling layers have no weights. More... | |
void | neural_layer_upsample_forward (const struct Layer *l, const struct Net *net, const double *input) |
Forward propagates an upsampling layer. More... | |
void | neural_layer_upsample_backward (const struct Layer *l, const struct Net *net, const double *input, double *delta) |
Backward propagates an upsampling layer. More... | |
void | neural_layer_upsample_update (const struct Layer *l) |
Dummy function since upsampling layers have no weights. More... | |
bool | neural_layer_upsample_mutate (struct Layer *l) |
Dummy function since upsampling layers cannot be mutated. More... | |
void | neural_layer_upsample_resize (struct Layer *l, const struct Layer *prev) |
Resizes an upsampling layer if the previous layer has changed size. More... | |
double * | neural_layer_upsample_output (const struct Layer *l) |
Returns the output from an upsampling layer. More... | |
void | neural_layer_upsample_print (const struct Layer *l, const bool print_weights) |
Prints an upsampling layer. More... | |
char * | neural_layer_upsample_json_export (const struct Layer *l, const bool return_weights) |
Returns a json formatted string representation of an upsample layer. More... | |
size_t | neural_layer_upsample_save (const struct Layer *l, FILE *fp) |
Writes an upsampling layer to a file. More... | |
size_t | neural_layer_upsample_load (struct Layer *l, FILE *fp) |
Reads an upsampling layer from a file. More... | |
An implementation of a 2D upsampling layer.
Definition in file neural_layer_upsample.c.
|
static |
Free memory used by an upsampling layer.
[in] | l | The layer to be freed. |
Definition at line 45 of file neural_layer_upsample.c.
References Layer::delta, and Layer::output.
Referenced by neural_layer_upsample_free(), and neural_layer_upsample_resize().
|
static |
Allocate memory used by an upsampling layer.
[in] | l | The layer to be allocated memory. |
Definition at line 33 of file neural_layer_upsample.c.
References Layer::delta, layer_guard_outputs(), Layer::n_outputs, and Layer::output.
Referenced by neural_layer_upsample_copy(), neural_layer_upsample_init(), neural_layer_upsample_load(), and neural_layer_upsample_resize().
void neural_layer_upsample_backward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input, | ||
double * | delta | ||
) |
Backward propagates an upsampling 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 156 of file neural_layer_upsample.c.
References Layer::c, Layer::channels, Layer::delta, Layer::h, Layer::height, Layer::i, Layer::stride, and Layer::width.
Initialises and copies one upsampling layer from another.
[in] | src | The source layer. |
Definition at line 88 of file neural_layer_upsample.c.
References 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::stride, Layer::type, UPSAMPLE, and Layer::width.
void neural_layer_upsample_forward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input | ||
) |
Forward propagates an upsampling 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_upsample.c.
References Layer::c, Layer::channels, Layer::h, Layer::height, Layer::i, Layer::output, Layer::stride, and Layer::width.
void neural_layer_upsample_free | ( | const struct Layer * | l | ) |
Free memory used by an upsampling layer.
[in] | l | The layer to be freed. |
Definition at line 56 of file neural_layer_upsample.c.
References free_layer_arrays().
Initialises a 2D upsampling layer.
[in] | l | Layer to initialise. |
[in] | args | Parameters to initialise the layer. |
Definition at line 67 of file neural_layer_upsample.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::stride, ArgsLayer::stride, Layer::width, and ArgsLayer::width.
char* neural_layer_upsample_json_export | ( | const struct Layer * | l, |
const bool | return_weights | ||
) |
Returns a json formatted string representation of an upsample layer.
[in] | l | The layer to return. |
[in] | return_weights | Whether to return the values of weights and biases. |
Definition at line 254 of file neural_layer_upsample.c.
References Layer::channels, Layer::height, Layer::n_inputs, Layer::n_outputs, Layer::stride, and Layer::width.
Referenced by neural_layer_upsample_print().
size_t neural_layer_upsample_load | ( | struct Layer * | l, |
FILE * | fp | ||
) |
Reads an upsampling layer from a file.
[in] | l | The layer to load. |
[in] | fp | Pointer to the file to be read. |
Definition at line 301 of file neural_layer_upsample.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, Layer::stride, and Layer::width.
bool neural_layer_upsample_mutate | ( | struct Layer * | l | ) |
Dummy function since upsampling layers cannot be mutated.
[in] | l | An upsampling layer. |
Definition at line 195 of file neural_layer_upsample.c.
double* neural_layer_upsample_output | ( | const struct Layer * | l | ) |
Returns the output from an upsampling layer.
[in] | l | The layer whose output to return. |
Definition at line 228 of file neural_layer_upsample.c.
References Layer::output.
void neural_layer_upsample_print | ( | const struct Layer * | l, |
const bool | print_weights | ||
) |
Prints an upsampling layer.
[in] | l | The layer to print. |
[in] | print_weights | Whether to print the values of weights and biases. |
Definition at line 239 of file neural_layer_upsample.c.
References neural_layer_upsample_json_export().
void neural_layer_upsample_rand | ( | struct Layer * | l | ) |
Dummy function since upsampling layers have no weights.
[in] | l | An average pooling layer. |
Definition at line 117 of file neural_layer_upsample.c.
Resizes an upsampling 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 207 of file neural_layer_upsample.c.
References Layer::channels, free_layer_arrays(), Layer::height, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::stride, and Layer::width.
size_t neural_layer_upsample_save | ( | const struct Layer * | l, |
FILE * | fp | ||
) |
Writes an upsampling layer to a file.
[in] | l | The layer to save. |
[in] | fp | Pointer to the file to be written. |
Definition at line 278 of file neural_layer_upsample.c.
References Layer::channels, Layer::height, Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::stride, and Layer::width.
void neural_layer_upsample_update | ( | const struct Layer * | l | ) |
Dummy function since upsampling layers have no weights.
[in] | l | An upsampling layer. |
Definition at line 184 of file neural_layer_upsample.c.