ANN  0.1.1.5
A library containing multiple neural network models written in C
layer.h File Reference

PCFNN_LAYER. More...

#include "../../config.h"
#include <stdlib.h>
#include "ANN/tools.h"
#include "neuron.h"
+ Include dependency graph for layer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PCFNN_LAYER_LINK
 Structure to represent a link between to PCFNN_LAYER. More...
 
struct  PCFNN_LAYER
 Layer unit. More...
 

Typedefs

typedef struct PCFNN_LAYER PCFNN_LAYER
 

Enumerations

enum  PCFNN_LAYER_TYPE { PCFNN_LAYER_INPUT, PCFNN_LAYER_HIDDEN, PCFNN_LAYER_OUTPUT }
 Type list of a layer. More...
 

Functions

struct PCFNN_LAYERPCFNN_LAYER_new (double(*f_init)(), double(*f_act)(double), double(*f_act_de)(double))
 
void PCFNN_LAYER_free (struct PCFNN_LAYER *l)
 Free all memory allocation of an PCFNN_LAYER (It will call PCFNN_NEURON_free) More...
 
void PCFNN_LAYER_clear (struct PCFNN_LAYER *l)
 Clear all neurons in the layer l (It will call PCFNN_NEURON_clear) More...
 
int PCFNN_LAYER_addn (struct PCFNN_LAYER *l, size_t size, size_t inputs, double(*f_init)(), double(*f_act)(double), double(*f_act_de)(double))
 Add neurons in the PCFNN_LAYER l. More...
 
struct PCFNN_LAYERPCFNN_LAYER_new_input (size_t size, double(*f_act)(double), double(*f_act_de)(double))
 Initialize a PCFNN_LAYER as an input layer. More...
 
int PCFNN_LAYER_connect (struct PCFNN_LAYER *from, struct PCFNN_LAYER *to, size_t size_from, size_t size_to, size_t offset_from, size_t offset_to, double(*f_init_to)(), double(*f_act_to)(double), double(*f_act_de_to)(double))
 Connect two PCFNN_LAYER. It will create a link between from and to. More...
 
int PCFNN_LAYER_build (struct PCFNN_LAYER *l)
 Initialize all internal data of the layer l and build of PCFNN_NEURON it contains. More...
 
size_t PCFNN_LAYER_get_ram_usage (struct PCFNN_LAYER *l)
 Give the number of bytes used by the PCFNN_LAYER l and all PCFNN_NEURON it contains. More...
 
void PCFNN_LAYER_set_lock_state (struct PCFNN_LAYER *l, enum PCFNN_NEURON_LOCK_STATE state, size_t size, size_t offset)
 Set lock state of size neurons of l starting by offset neuron of l. More...
 
void PCFNN_LAYER_summary (struct PCFNN_LAYER *l, size_t param[2])
 Write on param the number of unlocked parameters and locked parameters. More...
 

Detailed Description

PCFNN_LAYER.

Author
Cedric FARINAZZO
Version
0.1
Date
5 may 2019

Layer unit for PCFNN neural network

Definition in file layer.h.

Typedef Documentation

◆ PCFNN_LAYER

typedef struct PCFNN_LAYER PCFNN_LAYER

Enumeration Type Documentation

◆ PCFNN_LAYER_TYPE

Type list of a layer.

Enumerator
PCFNN_LAYER_INPUT 
PCFNN_LAYER_HIDDEN 
PCFNN_LAYER_OUTPUT 

Definition at line 24 of file layer.h.

Function Documentation

◆ PCFNN_LAYER_addn()

PCFNN_LAYER_addn ( struct PCFNN_LAYER l,
size_t  size,
size_t  inputs,
double(*)()  f_init,
double(*)(double)  f_act,
double(*)(double)  f_act_de 
)

Add neurons in the PCFNN_LAYER l.

Parameters
[in]l(struct PCFNN_LAYER*) a pointer an a PCFNN_LAYER
[in]size(size_t) number of PCFNN_NEURON to Add
[in]inputs(size_t) number of input for each new PCFNN_NEURON
[in]f_init(double(*f_init)()) a pointer on an weights/bias initialisation functon or NULL
[in]f_act(double(*f_act)(double)) a pointer on activation functon or NULL
[in]f_act_de(double(*f_act_de)(double)) a pointer on derivative activation functon who is the derivate of the f_act function pointer or NULL
Returns
0 if done, 1 if wrong arguments or -1 if an allocation failed and the layer is broken

Definition at line 59 of file layer.c.

+ Here is the call graph for this function:

◆ PCFNN_LAYER_build()

PCFNN_LAYER_build ( struct PCFNN_LAYER l)

Initialize all internal data of the layer l and build of PCFNN_NEURON it contains.

Parameters
[in]l(struct PCFNN_LAYER*) a pointer an a PCFNN_LAYER
Returns
0 if done, 1 if wrong arguments or -1 if an allocation failed and the layer is broken

Definition at line 130 of file layer.c.

+ Here is the call graph for this function:

◆ PCFNN_LAYER_clear()

PCFNN_LAYER_clear ( struct PCFNN_LAYER l)

Clear all neurons in the layer l (It will call PCFNN_NEURON_clear)

Parameters
[in]l(struct PCFNN_LAYER*) a pointer an a PCFNN_LAYER to clear

Definition at line 26 of file layer.c.

+ Here is the call graph for this function:

◆ PCFNN_LAYER_connect()

PCFNN_LAYER_connect ( struct PCFNN_LAYER from,
struct PCFNN_LAYER to,
size_t  size_from,
size_t  size_to,
size_t  offset_from,
size_t  offset_to,
double(*)()  f_init_to,
double(*)(double)  f_act_to,
double(*)(double)  f_act_de_to 
)

Connect two PCFNN_LAYER. It will create a link between from and to.

Parameters
[in]from(struct PCFNN_LAYER*) a pointer an a PCFNN_LAYER
[in]to(struct PCFNN_LAYER*) a pointer an a PCFNN_LAYER
[in]size_from(size_t) number of neuron of from to connect
[in]size_to(size_t) number of neuron of to to connect (It will create size_to neurons in to if necessary)
[in]offset_from(size_t) offset of offset_from where you want to start the connection for the from layer
[in]offset_to(size_t) offset of offset_to where you want to start the connection for the to layer
[in]f_init_to(double(*f_init_to)()) a pointer on an weights/bias initialisation functon or NULL (Will be use if need to create new neurons in the to layer)
[in]f_act_to(double(*f_act_to)(double)) a pointer on activation functon or NULL (Will be use if need to create new neurons in the to layer)
[in]f_act_de_to(double(*f_act_de_to)(double)) a pointer on derivative activation functon who is the derivate of the f_act function pointer or NULL (Will be use if need to create new neurons in the to layer)
Returns
0 if done, 1 if wrong arguments or -1 if an allocation failed and the layer is broken

Definition at line 89 of file layer.c.

◆ PCFNN_LAYER_free()

PCFNN_LAYER_free ( struct PCFNN_LAYER l)

Free all memory allocation of an PCFNN_LAYER (It will call PCFNN_NEURON_free)

Parameters
[in]l(struct PCFNN_LAYER*) a pointer an a PCFNN_LAYER to free

Definition at line 34 of file layer.c.

+ Here is the call graph for this function:

◆ PCFNN_LAYER_get_ram_usage()

PCFNN_LAYER_get_ram_usage ( struct PCFNN_LAYER l)

Give the number of bytes used by the PCFNN_LAYER l and all PCFNN_NEURON it contains.

Parameters
[in]l(struct PCFNN_LAYER*) a pointer an a PCFNN_LAYER
Returns
(size_t) number of bytes if l is NULL return 0

Definition at line 179 of file layer.c.

+ Here is the call graph for this function:

◆ PCFNN_LAYER_new()

struct PCFNN_LAYER* PCFNN_LAYER_new ( double(*)()  f_init,
double(*)(double)  f_act,
double(*)(double)  f_act_de 
)

Definition at line 8 of file layer.c.

◆ PCFNN_LAYER_new_input()

PCFNN_LAYER_new_input ( size_t  size,
double(*)(double)  f_act,
double(*)(double)  f_act_de 
)

Initialize a PCFNN_LAYER as an input layer.

Parameters
[in]size(size_t) number of neuron in this layer
[in]f_act(double(*f_act)(double)) a pointer on activation functon or NULL
[in]f_act_de(double(*f_act_de)(double)) a pointer on derivative activation functon who is the derivate of the f_act function pointer or NULL
Returns
PCFNN_LAYER structure pointer or NULL if an error occured

Definition at line 78 of file layer.c.

+ Here is the call graph for this function:

◆ PCFNN_LAYER_set_lock_state()

PCFNN_LAYER_set_lock_state ( struct PCFNN_LAYER l,
enum PCFNN_NEURON_LOCK_STATE  state,
size_t  size,
size_t  offset 
)

Set lock state of size neurons of l starting by offset neuron of l.

Parameters
[in]l(struct PCFNN_LAYER*) a pointer an a PCFNN_LAYER
[in]state(enum PCFNN_NEURON_LOCK_STATE) lock state
[in]size(size_t) number of neurons to set lock state
[in]offset(size_t) neurons offset

Definition at line 191 of file layer.c.

+ Here is the call graph for this function:

◆ PCFNN_LAYER_summary()

PCFNN_LAYER_summary ( struct PCFNN_LAYER l,
size_t  param[2] 
)

Write on param the number of unlocked parameters and locked parameters.

Parameters
[in]l(struct PCFNN_LAYER*) a pointer an a PCFNN_LAYER
[out]param(size_t) param[0] will be the number of unlocked parameters and param[1] the number of locked parameters

Definition at line 199 of file layer.c.

+ Here is the call graph for this function: