| XCSF 1.4.8
    XCSF learning classifier system | 
An implementation of a long short-term memory layer. More...
#include "neural_layer.h"Go to the source code of this file.
| Functions | |
| void | neural_layer_lstm_init (struct Layer *l, const struct ArgsLayer *args) | 
| Initialises a long short-term memory layer. | |
| struct Layer * | neural_layer_lstm_copy (const struct Layer *src) | 
| Initialises and creates a copy of one LSTM layer from another. | |
| void | neural_layer_lstm_rand (struct Layer *l) | 
| Randomises an LSTM layer weights. | |
| void | neural_layer_lstm_forward (const struct Layer *l, const struct Net *net, const double *input) | 
| Forward propagates an LSTM layer. | |
| void | neural_layer_lstm_backward (const struct Layer *l, const struct Net *net, const double *input, double *delta) | 
| Backward propagates an LSTM layer. | |
| void | neural_layer_lstm_update (const struct Layer *l) | 
| Updates the weights and biases of an LSTM layer. | |
| void | neural_layer_lstm_print (const struct Layer *l, const bool print_weights) | 
| Prints an LSTM layer. | |
| bool | neural_layer_lstm_mutate (struct Layer *l) | 
| Mutates an LSTM layer. | |
| void | neural_layer_lstm_free (const struct Layer *l) | 
| Free memory used by an LSTM layer. | |
| double * | neural_layer_lstm_output (const struct Layer *l) | 
| Returns the output from an LSTM layer. | |
| size_t | neural_layer_lstm_save (const struct Layer *l, FILE *fp) | 
| Writes an LSTM layer to a file. | |
| size_t | neural_layer_lstm_load (struct Layer *l, FILE *fp) | 
| Reads an LSTM layer from a file. | |
| void | neural_layer_lstm_resize (struct Layer *l, const struct Layer *prev) | 
| Resizes an LSTM layer if the previous layer has changed size. | |
| char * | neural_layer_lstm_json_export (const struct Layer *l, const bool return_weights) | 
| Returns a json formatted string representation of an LSTM layer. | |
| Variables | |
| static struct LayerVtbl const | layer_lstm_vtbl | 
| Neural long short-term memory layer implemented functions. | |
An implementation of a long short-term memory layer.
Definition in file neural_layer_lstm.h.
| void neural_layer_lstm_backward | ( | const struct Layer * | l, | 
| const struct Net * | net, | ||
| const double * | input, | ||
| double * | delta | ||
| ) | 
Backward propagates an LSTM 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 461 of file neural_layer_lstm.c.
References blas_axpy(), blas_mul(), Layer::c, Layer::dc, Layer::delta, Layer::f, Layer::function, Layer::g, Layer::i, layer_backward(), Layer::n_outputs, neural_activate_array(), neural_gradient_array(), Layer::o, Layer::prev_cell, Layer::prev_state, Layer::recurrent_function, reset_layer_deltas(), Layer::temp, Layer::temp2, Layer::temp3, Layer::uf, Layer::ug, Layer::ui, Layer::uo, Layer::wf, Layer::wg, Layer::wi, and Layer::wo.
Initialises and creates a copy of one LSTM layer from another.
| [in] | src | The source layer. | 
Definition at line 327 of file neural_layer_lstm.c.
References Layer::decay, Layer::eta, Layer::eta_max, Layer::function, layer_copy(), layer_defaults(), Layer::layer_vptr, LSTM, malloc_layer_arrays(), Layer::max_neuron_grow, Layer::max_outputs, Layer::momentum, Layer::mu, Layer::n_active, Layer::n_biases, Layer::n_inputs, N_MU, Layer::n_outputs, Layer::n_weights, Layer::options, Layer::out_c, Layer::out_h, Layer::out_w, Layer::recurrent_function, Layer::type, Layer::uf, Layer::ug, Layer::ui, Layer::uo, Layer::wf, Layer::wg, Layer::wi, and Layer::wo.
| void neural_layer_lstm_forward | ( | const struct Layer * | l, | 
| const struct Net * | net, | ||
| const double * | input | ||
| ) | 
Forward propagates an LSTM layer.
| [in] | l | The layer to forward propagate. | 
| [in] | net | Network containing the layer. | 
| [in] | input | The input to the layer. | 
Definition at line 419 of file neural_layer_lstm.c.
References blas_axpy(), blas_mul(), Layer::c, Layer::cell, Layer::f, Layer::function, Layer::g, Layer::h, Layer::i, layer_forward(), Layer::n_outputs, neural_activate_array(), Layer::o, Layer::output, Layer::recurrent_function, Layer::temp, Layer::uf, Layer::ug, Layer::ui, Layer::uo, Layer::wf, Layer::wg, Layer::wi, and Layer::wo.
| void neural_layer_lstm_free | ( | const struct Layer * | l | ) | 
Free memory used by an LSTM layer.
| [in] | l | The layer to be freed. | 
Definition at line 373 of file neural_layer_lstm.c.
References free_layer_arrays(), layer_free(), Layer::mu, Layer::uf, Layer::ug, Layer::ui, Layer::uo, Layer::wf, Layer::wg, Layer::wi, and Layer::wo.
Initialises a long short-term memory layer.
| [in] | l | Layer to initialise. | 
| [in] | args | Parameters to initialise the layer. | 
Definition at line 284 of file neural_layer_lstm.c.
References CONNECTED, Layer::decay, ArgsLayer::decay, ArgsLayer::eta, Layer::eta_max, Layer::function, ArgsLayer::function, layer_args_copy(), layer_args_opt(), layer_init(), LINEAR, malloc_layer_arrays(), Layer::max_neuron_grow, ArgsLayer::max_neuron_grow, Layer::max_outputs, Layer::momentum, ArgsLayer::momentum, Layer::mu, MU_TYPE, ArgsLayer::n_init, Layer::n_inputs, ArgsLayer::n_inputs, ArgsLayer::n_max, N_MU, Layer::n_outputs, Layer::options, Layer::out_c, Layer::out_h, Layer::out_w, Layer::recurrent_function, ArgsLayer::recurrent_function, sam_init(), set_eta(), set_layer_n_active(), set_layer_n_biases(), set_layer_n_weights(), ArgsLayer::type, Layer::uf, Layer::ug, Layer::ui, Layer::uo, Layer::wf, Layer::wg, Layer::wi, and Layer::wo.
| char * neural_layer_lstm_json_export | ( | const struct Layer * | l, | 
| const bool | return_weights | ||
| ) | 
Returns a json formatted string representation of an LSTM layer.
| [in] | l | The layer to return. | 
| [in] | return_weights | Whether to returnprint the values of weights and biases. | 
Definition at line 605 of file neural_layer_lstm.c.
References Layer::eta, Layer::function, layer_weight_json(), Layer::mu, Layer::n_inputs, N_MU, Layer::n_outputs, neural_activation_string(), Layer::recurrent_function, Layer::uf, Layer::ug, Layer::ui, Layer::uo, Layer::wf, Layer::wg, Layer::wi, and Layer::wo.
Referenced by neural_layer_lstm_print().
| size_t neural_layer_lstm_load | ( | struct Layer * | l, | 
| FILE * | fp | ||
| ) | 
Reads an LSTM layer from a file.
| [in] | l | The layer to load. | 
| [in] | fp | Pointer to the file to be read. | 
Definition at line 709 of file neural_layer_lstm.c.
References Layer::c, Layer::cell, Layer::dc, Layer::decay, Layer::eta, Layer::eta_max, Layer::f, Layer::g, Layer::h, Layer::i, layer_load(), malloc_layer_arrays(), malloc_layers(), Layer::max_neuron_grow, Layer::max_outputs, Layer::momentum, Layer::mu, Layer::n_active, Layer::n_biases, Layer::n_inputs, N_MU, Layer::n_outputs, Layer::n_weights, Layer::o, Layer::options, Layer::out_c, Layer::out_h, Layer::out_w, Layer::prev_state, Layer::state, Layer::temp, Layer::temp2, Layer::temp3, Layer::uf, Layer::ug, Layer::ui, Layer::uo, Layer::wf, Layer::wg, Layer::wi, and Layer::wo.
| bool neural_layer_lstm_mutate | ( | struct Layer * | l | ) | 
Mutates an LSTM layer.
| [in] | l | The layer to mutate. | 
Definition at line 561 of file neural_layer_lstm.c.
References LAYER_EVOLVE_CONNECT, LAYER_EVOLVE_ETA, LAYER_EVOLVE_FUNCTIONS, LAYER_EVOLVE_NEURONS, LAYER_EVOLVE_WEIGHTS, layer_mutate_functions(), Layer::mu, MU_TYPE, mutate_connectivity(), mutate_eta(), mutate_neurons(), mutate_weights(), N_MU, Layer::options, and sam_adapt().
| double * neural_layer_lstm_output | ( | const struct Layer * | l | ) | 
Returns the output from an LSTM layer.
| [in] | l | The layer whose output to return. | 
Definition at line 550 of file neural_layer_lstm.c.
References Layer::output.
| void neural_layer_lstm_print | ( | const struct Layer * | l, | 
| const bool | print_weights | ||
| ) | 
Prints an LSTM layer.
| [in] | l | The layer to print. | 
| [in] | print_weights | Whether to print the values of weights and biases. | 
Definition at line 590 of file neural_layer_lstm.c.
References neural_layer_lstm_json_export().
| void neural_layer_lstm_rand | ( | struct Layer * | l | ) | 
Resizes an LSTM 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 531 of file neural_layer_lstm.c.
References layer_resize(), Layer::n_inputs, Layer::n_outputs, set_layer_n_active(), set_layer_n_biases(), set_layer_n_weights(), Layer::uf, Layer::ug, Layer::ui, and Layer::uo.
| size_t neural_layer_lstm_save | ( | const struct Layer * | l, | 
| FILE * | fp | ||
| ) | 
Writes an LSTM layer to a file.
| [in] | l | The layer to save. | 
| [in] | fp | Pointer to the file to be written. | 
Definition at line 662 of file neural_layer_lstm.c.
References Layer::c, Layer::cell, Layer::dc, Layer::decay, Layer::eta, Layer::eta_max, Layer::f, Layer::g, Layer::h, Layer::i, layer_save(), Layer::max_neuron_grow, Layer::max_outputs, Layer::momentum, Layer::mu, Layer::n_active, Layer::n_biases, Layer::n_inputs, N_MU, Layer::n_outputs, Layer::n_weights, Layer::o, Layer::options, Layer::prev_state, Layer::state, Layer::temp, Layer::temp2, Layer::temp3, Layer::uf, Layer::ug, Layer::ui, Layer::uo, Layer::wf, Layer::wg, Layer::wi, and Layer::wo.
| void neural_layer_lstm_update | ( | const struct Layer * | l | ) | 
Updates the weights and biases of an LSTM layer.
| [in] | l | The layer to update. | 
Definition at line 511 of file neural_layer_lstm.c.
References Layer::eta, LAYER_SGD_WEIGHTS, layer_update(), Layer::options, Layer::uf, Layer::ug, Layer::ui, Layer::uo, Layer::wf, Layer::wg, Layer::wi, and Layer::wo.
| 
 | static | 
Neural long short-term memory layer implemented functions.
Definition at line 75 of file neural_layer_lstm.h.
Referenced by layer_set_vptr().