XCSF  1.4.7
XCSF learning classifier system
neural_layer_args.h File Reference

Functions operating on neural network arguments/constants. More...

#include "utils.h"
Include dependency graph for neural_layer_args.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ArgsLayer
 Parameters for initialising a neural network layer. More...
 

Functions

void layer_args_init (struct ArgsLayer *args)
 Sets layer parameters to default values. More...
 
struct ArgsLayerlayer_args_copy (const struct ArgsLayer *src)
 Creates and returns a copy of specified layer parameters. More...
 
struct ArgsLayerlayer_args_tail (struct ArgsLayer *head)
 Returns the current output layer arguments. More...
 
char * layer_args_json_import (struct ArgsLayer *largs, cJSON *json)
 Sets the layer parameters from a cJSON object. More...
 
char * layer_args_json_export (struct ArgsLayer *args)
 Returns a json formatted string of the neural layer parameters. More...
 
void layer_args_free (struct ArgsLayer **largs)
 Frees memory used by a list of layer parameters and points to NULL. More...
 
void layer_args_validate (struct ArgsLayer *args)
 Checks network layer arguments are valid. More...
 
uint32_t layer_args_opt (const struct ArgsLayer *args)
 Returns a bitstring representing the permissions granted by a layer. More...
 
size_t layer_args_save (const struct ArgsLayer *args, FILE *fp)
 Saves neural network layer parameters. More...
 
size_t layer_args_load (struct ArgsLayer **largs, FILE *fp)
 Loads neural network layer parameters. More...
 

Detailed Description

Functions operating on neural network arguments/constants.

Author
Richard Preen rpree.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om
Date
2020–2022.

Definition in file neural_layer_args.h.

Function Documentation

◆ layer_args_copy()

◆ layer_args_free()

void layer_args_free ( struct ArgsLayer **  largs)

Frees memory used by a list of layer parameters and points to NULL.

Parameters
[in]largsPointer to the list of layer parameters to free.

Definition at line 451 of file neural_layer_args.c.

References ArgsLayer::next.

Referenced by act_neural_param_json_import(), action_param_free(), cond_neural_param_json_import(), cond_param_free(), layer_args_load(), pred_neural_param_json_import(), and pred_param_free().

Here is the caller graph for this function:

◆ layer_args_init()

◆ layer_args_json_export()

char* layer_args_json_export ( struct ArgsLayer args)

Returns a json formatted string of the neural layer parameters.

Parameters
[in]argsThe layer parameters to print.
Returns
String encoded in json format.

Definition at line 377 of file neural_layer_args.c.

References layer_args_json_export_activation(), layer_args_json_export_evo(), layer_args_json_export_inputs(), layer_args_json_export_scale(), layer_args_json_export_sgd(), layer_type_as_string(), neural_create(), neural_free(), neural_init(), and ArgsLayer::next.

Referenced by action_param_json_export(), cond_param_json_export(), and pred_param_json_export().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_args_json_import()

char* layer_args_json_import ( struct ArgsLayer args,
cJSON *  json 
)

Sets the layer parameters from a cJSON object.

Parameters
[in,out]argsLayer parameters data structure.
[in]jsoncJSON object.
Returns
NULL if successful; or the name of parameter if not found.

Definition at line 415 of file neural_layer_args.c.

References layer_args_json_import_activation(), layer_args_json_import_evo(), layer_args_json_import_inputs(), layer_args_json_import_scale(), layer_args_json_import_sgd(), layer_type_as_int(), ArgsLayer::n_init, and ArgsLayer::type.

Referenced by act_neural_param_json_import(), cond_neural_param_json_import(), and pred_neural_param_json_import().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_args_load()

size_t layer_args_load ( struct ArgsLayer **  largs,
FILE *  fp 
)

Loads neural network layer parameters.

Parameters
[in]largsPointer to the list of layer parameters to load.
[in]fpPointer to the output file.
Returns
The total number of elements read.

Definition at line 633 of file neural_layer_args.c.

References ArgsLayer::channels, ArgsLayer::decay, ArgsLayer::eta, ArgsLayer::eta_min, ArgsLayer::evolve_connect, ArgsLayer::evolve_eta, ArgsLayer::evolve_functions, ArgsLayer::evolve_neurons, ArgsLayer::evolve_weights, ArgsLayer::function, ArgsLayer::height, layer_args_free(), layer_args_init(), ArgsLayer::max_neuron_grow, ArgsLayer::momentum, ArgsLayer::n_init, ArgsLayer::n_inputs, ArgsLayer::n_max, ArgsLayer::next, ArgsLayer::pad, ArgsLayer::probability, ArgsLayer::recurrent_function, ArgsLayer::scale, ArgsLayer::sgd_weights, ArgsLayer::size, ArgsLayer::stride, ArgsLayer::type, and ArgsLayer::width.

Referenced by action_param_load(), cond_param_load(), and pred_param_load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_args_opt()

uint32_t layer_args_opt ( const struct ArgsLayer args)

Returns a bitstring representing the permissions granted by a layer.

Parameters
[in]argsLayer initialisation parameters.
Returns
Bitstring representing the layer options.

Definition at line 541 of file neural_layer_args.c.

References ArgsLayer::evolve_connect, ArgsLayer::evolve_eta, ArgsLayer::evolve_functions, ArgsLayer::evolve_neurons, ArgsLayer::evolve_weights, LAYER_EVOLVE_CONNECT, LAYER_EVOLVE_ETA, LAYER_EVOLVE_FUNCTIONS, LAYER_EVOLVE_NEURONS, LAYER_EVOLVE_WEIGHTS, LAYER_SGD_WEIGHTS, and ArgsLayer::sgd_weights.

Referenced by neural_layer_connected_init(), neural_layer_convolutional_init(), neural_layer_lstm_init(), and neural_layer_recurrent_init().

Here is the caller graph for this function:

◆ layer_args_save()

size_t layer_args_save ( const struct ArgsLayer args,
FILE *  fp 
)

Saves neural network layer parameters.

Parameters
[in]argsLayer initialisation parameters.
[in]fpPointer to the output file.
Returns
The total number of elements written.

Definition at line 589 of file neural_layer_args.c.

References ArgsLayer::channels, ArgsLayer::decay, ArgsLayer::eta, ArgsLayer::eta_min, ArgsLayer::evolve_connect, ArgsLayer::evolve_eta, ArgsLayer::evolve_functions, ArgsLayer::evolve_neurons, ArgsLayer::evolve_weights, ArgsLayer::function, ArgsLayer::height, layer_args_length(), ArgsLayer::max_neuron_grow, ArgsLayer::momentum, ArgsLayer::n_init, ArgsLayer::n_inputs, ArgsLayer::n_max, ArgsLayer::next, ArgsLayer::pad, ArgsLayer::probability, ArgsLayer::recurrent_function, ArgsLayer::scale, ArgsLayer::sgd_weights, ArgsLayer::size, ArgsLayer::stride, ArgsLayer::type, and ArgsLayer::width.

Referenced by action_param_save(), cond_param_save(), and pred_param_save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_args_tail()

struct ArgsLayer* layer_args_tail ( struct ArgsLayer head)

Returns the current output layer arguments.

Parameters
[in]headHead of the list of layer parameters.
Returns
Layer parameters pertaining to the current output layer.

Definition at line 526 of file neural_layer_args.c.

References ArgsLayer::next.

◆ layer_args_validate()

void layer_args_validate ( struct ArgsLayer args)

Checks network layer arguments are valid.

Parameters
[in]argsList of layer parameters to check.

Definition at line 500 of file neural_layer_args.c.

References ArgsLayer::evolve_neurons, layer_args_validate_inputs(), ArgsLayer::max_neuron_grow, ArgsLayer::n_init, ArgsLayer::n_max, and ArgsLayer::next.

Referenced by act_neural_param_json_import(), cond_neural_param_json_import(), and pred_neural_param_json_import().

Here is the call graph for this function:
Here is the caller graph for this function: