XCSF
1.4.7
XCSF learning classifier system
|
An implementation of a softmax layer. More...
#include "neural_layer.h"
Go to the source code of this file.
Functions | |
void | neural_layer_softmax_init (struct Layer *l, const struct ArgsLayer *args) |
Creates and initialises a softmax layer. More... | |
struct Layer * | neural_layer_softmax_copy (const struct Layer *src) |
Initialises and creates a copy of one softmax layer from another. More... | |
void | neural_layer_softmax_rand (struct Layer *l) |
Dummy function since softmax layers have no weights. More... | |
void | neural_layer_softmax_forward (const struct Layer *l, const struct Net *net, const double *input) |
Forward propagates a softmax layer. More... | |
void | neural_layer_softmax_backward (const struct Layer *l, const struct Net *net, const double *input, double *delta) |
Backward propagates a softmax layer. More... | |
void | neural_layer_softmax_update (const struct Layer *l) |
Dummy function since a softmax layer has no weights. More... | |
void | neural_layer_softmax_print (const struct Layer *l, const bool print_weights) |
Prints a softmax layer. More... | |
bool | neural_layer_softmax_mutate (struct Layer *l) |
Dummy function since a softmax layer cannot be mutated. More... | |
void | neural_layer_softmax_free (const struct Layer *l) |
Free memory used by a softmax layer. More... | |
double * | neural_layer_softmax_output (const struct Layer *l) |
Returns the output from a softmax layer. More... | |
size_t | neural_layer_softmax_save (const struct Layer *l, FILE *fp) |
Writes a softmax layer to a file. More... | |
size_t | neural_layer_softmax_load (struct Layer *l, FILE *fp) |
Reads a softmax layer from a file. More... | |
void | neural_layer_softmax_resize (struct Layer *l, const struct Layer *prev) |
Resizes a softmax layer if the previous layer has changed size. More... | |
char * | neural_layer_softmax_json_export (const struct Layer *l, const bool return_weights) |
Returns a json formatted string representation of a softmax layer. More... | |
Variables | |
static struct LayerVtbl const | layer_softmax_vtbl |
Neural softmax layer implemented functions. More... | |
An implementation of a softmax layer.
Definition in file neural_layer_softmax.h.
void neural_layer_softmax_backward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input, | ||
double * | delta | ||
) |
Backward propagates a softmax 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 142 of file neural_layer_softmax.c.
References Layer::delta, Layer::i, and Layer::n_inputs.
Initialises and creates a copy of one softmax layer from another.
[in] | src | The source layer. |
Definition at line 75 of file neural_layer_softmax.c.
References 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::scale, SOFTMAX, and Layer::type.
void neural_layer_softmax_forward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input | ||
) |
Forward propagates a softmax layer.
[in] | l | Layer to forward propagate. |
[in] | net | Network containing the layer. |
[in] | input | Input to the layer. |
Definition at line 113 of file neural_layer_softmax.c.
References Layer::i, Layer::n_inputs, Layer::output, and Layer::scale.
void neural_layer_softmax_free | ( | const struct Layer * | l | ) |
Free memory used by a softmax layer.
[in] | l | The layer to be freed. |
Definition at line 234 of file neural_layer_softmax.c.
References free_layer_arrays().
Creates and initialises a softmax layer.
[in] | l | Layer to initialise. |
[in] | args | Parameters to initialise the layer. |
Definition at line 57 of file neural_layer_softmax.c.
References 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::scale, and ArgsLayer::scale.
char* neural_layer_softmax_json_export | ( | const struct Layer * | l, |
const bool | return_weights | ||
) |
Returns a json formatted string representation of a softmax layer.
[in] | l | The layer to return. |
[in] | return_weights | Whether to return the values of weights and biases. |
Definition at line 185 of file neural_layer_softmax.c.
References Layer::n_inputs, Layer::n_outputs, and Layer::scale.
Referenced by neural_layer_softmax_print().
size_t neural_layer_softmax_load | ( | struct Layer * | l, |
FILE * | fp | ||
) |
Reads a softmax layer from a file.
[in] | l | The layer to load. |
[in] | fp | Pointer to the file to be read. |
Definition at line 274 of file neural_layer_softmax.c.
References malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, and Layer::scale.
bool neural_layer_softmax_mutate | ( | struct Layer * | l | ) |
Dummy function since a softmax layer cannot be mutated.
[in] | l | A softmax layer. |
Definition at line 205 of file neural_layer_softmax.c.
double* neural_layer_softmax_output | ( | const struct Layer * | l | ) |
Returns the output from a softmax layer.
[in] | l | The layer whose output to return. |
Definition at line 245 of file neural_layer_softmax.c.
References Layer::output.
void neural_layer_softmax_print | ( | const struct Layer * | l, |
const bool | print_weights | ||
) |
Prints a softmax layer.
[in] | l | The layer to print. |
[in] | print_weights | Whether to print the values of weights and biases. |
Definition at line 170 of file neural_layer_softmax.c.
References neural_layer_softmax_json_export().
void neural_layer_softmax_rand | ( | struct Layer * | l | ) |
Dummy function since softmax layers have no weights.
[in] | l | A softmax layer. |
Definition at line 101 of file neural_layer_softmax.c.
Resizes a softmax 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 217 of file neural_layer_softmax.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_softmax_save | ( | const struct Layer * | l, |
FILE * | fp | ||
) |
Writes a softmax layer to a file.
[in] | l | The layer to save. |
[in] | fp | Pointer to the file to be written. |
Definition at line 257 of file neural_layer_softmax.c.
References Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, and Layer::scale.
void neural_layer_softmax_update | ( | const struct Layer * | l | ) |
Dummy function since a softmax layer has no weights.
[in] | l | A softmax layer. |
Definition at line 159 of file neural_layer_softmax.c.
|
static |
Neural softmax layer implemented functions.
Definition at line 69 of file neural_layer_softmax.h.
Referenced by layer_set_vptr().