#include "gnn_pbundle.h"#include "gnn_node_vector.h"Include dependency graph for gnn_node.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | _gnn_node |
| gnn_node Fundamental Structure. More... | |
Defines | |
| #define | GNN_NODE_SUB_INSTALL(_node_, _size_, _status_) |
Typedefs | |
| typedef _gnn_node | gnn_node |
| gnn_node type definition. | |
| typedef int(* | gnn_node_f )(gnn_node *node, const gsl_vector *x, const gsl_vector *w, gsl_vector *y) |
| gnn_node_f type definition. | |
| typedef int(* | gnn_node_df )(gnn_node *node, const gsl_vector *x, const gsl_vector *w, const gsl_vector *dy, gsl_vector *dxw) |
| gnn_node_df type definition. | |
| typedef void(* | gnn_node_destructor )(gnn_node *layer) |
| gnn_node_destructor type definition. | |
Functions | |
| int | gnn_node_is_root (gnn_node *node) |
| Check if node is root node. | |
| const char * | gnn_node_get_type_name (gnn_node *node) |
| Get the node's type. | |
| int | gnn_node_input_get_size (gnn_node *node) |
| Get the node's input size. | |
| int | gnn_node_output_get_size (gnn_node *node) |
| Get the node's output size. | |
| int | gnn_node_destroy (gnn_node *node) |
| Destroys the current node. | |
| int | gnn_node_evaluate_init (gnn_node *node) |
| Initializes the evaluations. | |
| int | gnn_node_evaluate_f (gnn_node *node, const gsl_vector *x, gsl_vector *y) |
| Evaluates the output of the function recursively. | |
| int | gnn_node_evaluate_dx (gnn_node *node, const gsl_vector *dy, gsl_vector *dx) |
Evaluates the gradient
. | |
| int | gnn_node_evaluate_dw (gnn_node *node, gsl_vector *dw) |
Evaluates the gradient
. | |
| int | gnn_node_param_get_size (gnn_node *node) |
| Returns the size of the parameter vector. | |
| int | gnn_node_param_get (gnn_node *node, gsl_vector *w) |
| Get the node's parameters. | |
| int | gnn_node_param_set (gnn_node *node, const gsl_vector *w) |
| Sets new values for the parameter vector. | |
| int | gnn_node_param_freeze_flags_get (gnn_node *node, gsl_vector_int *f) |
| Get the freeze flags. | |
| int | gnn_node_param_freeze_flags_set (gnn_node *node, const gsl_vector_int *f) |
| Sets new freeze flags. | |
| int | gnn_node_param_freeze (gnn_node *node, int i) |
| Freeze the i-th parameter. | |
| int | gnn_node_param_unfreeze (gnn_node *node, int i) |
| Unfreeze the i-th parameter. | |
| int | gnn_node_param_is_frozen (gnn_node *node, int i) |
| Check if the i-th parameter is frozen. | |
| int | gnn_node_param_are_frozen (gnn_node *node) |
| Check if all the node's parameters are frozen. | |
| int | gnn_node_param_freeze_all (gnn_node *node) |
| Freeze all parameters. | |
| int | gnn_node_param_unfreeze_all (gnn_node *node) |
| Unfreeze all parameters. | |
| int | gnn_node_param_share (const gnn_node *node, gnn_node *client) |
| Share the node's parameters. | |
| int | gnn_node_init (gnn_node *node, const char *type, gnn_node_f f, gnn_node_df dx, gnn_node_df dw, gnn_node_destructor dest) |
| Initializes a gnn_node structure. | |
| int | gnn_node_set_sizes (gnn_node *node, int n, int m, int l) |
| Set the node's sizes. | |
| gsl_vector * | gnn_node_local_get_w (gnn_node *node) |
| Get local parameters. | |
| gsl_vector * | gnn_node_local_get_dw (gnn_node *node) |
| Get local parameter gradients. | |
| gsl_vector_int * | gnn_node_local_get_f (gnn_node *node) |
| Get local parameters frozen flags. | |
| int | gnn_node_local_update (gnn_node *node) |
| Get local parameters. | |
| int | gnn_node_eval_f (gnn_node *node, const gsl_vector *x, gsl_vector *y) |
| Evaluates the output of the function recursively. | |
| int | gnn_node_eval_dx (gnn_node *node, const gsl_vector *dy, gsl_vector *dx) |
Evaluates
recursively. | |
| int | gnn_node_eval_dw (gnn_node *node) |
Evaluates
recursively. | |
| int | gnn_node_sub_install_specific (gnn_node *node, int nsub,...) |
| Install subnodes. | |
| int | gnn_node_sub_install (gnn_node *node, int nsub, va_list subs) |
| Install subnodes. | |
| int | gnn_node_sub_install_node_vector (gnn_node *node, gnn_node_vector *vector) |
| Install the nodes in the node vector as subnodes. | |
| int | gnn_node_sub_get_number (gnn_node *node) |
| Get the number of subnodes. | |
| gnn_node * | gnn_node_sub_get_node_at (gnn_node *node, int i) |
| Get's the node's i-th subnode. | |
| gnn_pbundle * | gnn_node_sub_search_params (gnn_node *node, const char *type) |
| Get all subnodes of a given type. | |
|
|
Value: { \
va_list args; \
va_start(args, (_size_)); \
(_status_) = gnn_node_sub_install ((_node_), (_size_), args); \
va_end(args); \
}Definition at line 40 of file gnn_node.h. |
|
|
The gnn_node C type for libgnn node implementations. Definition at line 60 of file gnn_node.h. |
|
|
This is the type for gnn_node's destroy functions. An example function is: void my_destroy (gnn_node *node) { // function implementation ... } Definition at line 126 of file gnn_node.h. |
|
|
This is the type for gnn_node's evaluation function gradients. An example function is: int my_func_gradient (gnn_node *node, const gsl_vector *x, const gsl_vector *w, const gsl_vector *dy, gsl_vector *dw); { // function implementation ... } Definition at line 104 of file gnn_node.h. |
|
|
This is the type for gnn_node's evaluation functions. An example function is: int my_func (gnn_node *node, const gsl_vector *x, const gsl_vector *w, gsl_vector *y) { // function implementation ... } Definition at line 80 of file gnn_node.h. |
|
|
This function detroys the node given as a parameter: it calls first the installed destructor and the gnn_node Extension API to destroy itself. This is a virtual function: the specific destruction of the node is given by the installed gnn_node::destroy function, and the destruction of the underlying's node structure by itself is performed by gnn_node Extension API.
Definition at line 500 of file gnn_node.c. |
|
|
This function calls the installed gnn_node::dw function with the appropiate arguments. This function should only be called from construction node's evaluation functions. If you want to evaluate it from outside, you should call \gnn_node_eval_dw instead, which initiates the recursion parameters appropiatelly.
Definition at line 1425 of file gnn_node.c. |
|
||||||||||||||||
|
This function calls the installed gnn_node::dx function with the appropiate arguments. This function should only be called from construction node's evaluation functions. If you want to evaluate it from outside, you should call \gnn_node_eval_dx instead, which initiates the recursion parameters appropiatelly.
Definition at line 1388 of file gnn_node.c. |
|
||||||||||||||||
|
This function calls the installed gnn_node::f function with the appropiate arguments. This function should only be called from construction node's evaluation functions. If you want to evaluate it from outside, you should call \gnn_node_eval_f instead, which initiates the recursion parameters appropiatelly.
Definition at line 1354 of file gnn_node.c. |
|
||||||||||||
|
This function computes
@warning: The
Definition at line 653 of file gnn_node.c. |
|
||||||||||||||||
|
This function computes
@warning: The
Definition at line 609 of file gnn_node.c. |
|
||||||||||||||||
|
This function computes the output of the node's function. First, it sets the appropiate values for initiating the recursive evaluation, and then calls gnn_node_eval_f.
@warning: If you want to compute
Definition at line 538 of file gnn_node.c. |
|
|
This function initializes the gradient evaluation routines. It should be called before gnn_node_eval_f, for every single pattern or input evaluation. The complete sequence for evaluations is:
Definition at line 579 of file gnn_node.c. |
|
|
This function returns the node's type: an unique string which identifies a node's type. Generally speaking, the type depends on which constructor function was used to instantiate the node. Per example, gnn_weight_new () creates a "gnn_weight" node, gnn_tanh_new () creates a "gnn_tanh" node. The returned string is owned by the node and should not be freed or manipulated in any other way.
Definition at line 440 of file gnn_node.c. |
|
||||||||||||||||||||||||||||
|
This function initializes a gnn_node structure. The memory for the structure should be allocated manually. The sizes should be set after calling this function. An example of its use is the following:
gnn_node * gnn_mifunction (int input_size, int output_size, int param_size) { gnn_node *node; node = (gnn_node *) malloc (sizeof (*node)); gnn_node_init ( node, "gnn_mifunction", gnn_mifunction_f, gnn_mifunction_dx, gnn_mifunction_dw, gnn_mifunction_dest); gnn_node_set_sizes (input_size, output_size, param_size); // initialize the rest ... If one of the function pointers is NULL, then it installs the default functions:
Definition at line 1183 of file gnn_node.c. |
|
|
This function returns the size
Definition at line 458 of file gnn_node.c. |
|
|
This function returns 1 if the current node is a root node, or 0 if not.
Definition at line 413 of file gnn_node.c. |
|
|
This function returns a pointer to the node's own parameters gradient
Definition at line 1292 of file gnn_node.c. |
|
|
This function returns a pointer to the node's own parameters frozen flags. The returning vector is the flags vector itself and its values can be freely changed. When finished, call gnn_node_local_update. The values should be binary: 0 means that the parameter is free, and 1 (non-zero) means that the parameter is frozen (fixed).
Definition at line 1313 of file gnn_node.c. |
|
|
This function returns a pointer to the node's own parameters. The returning vector is the parameter vector itself and its values can be freely changed. When finished, call gnn_node_local_update.
Definition at line 1272 of file gnn_node.c. |
|
|
This function updates the local parameters and its changes. This function should be called after any change in the parameters to make them effective.
Definition at line 1330 of file gnn_node.c. |
|
|
This function returns the size
Definition at line 475 of file gnn_node.c. |
|
|
This function returns 1 if all parameters are frozen.
Definition at line 912 of file gnn_node.c. |
|
||||||||||||
|
This function freezes the i-th parameter.
Definition at line 862 of file gnn_node.c. |
|
|
This function freezes all the node's parameters.
Definition at line 931 of file gnn_node.c. |
|
||||||||||||
|
This function fills the given integer vector f with the node's freeze flags. Implementation Note: The parameter vector is build with the node's parameter bundle.
Definition at line 826 of file gnn_node.c. |
|
||||||||||||
|
This function sets new freeze flags for the node. They should be given as a
Definition at line 845 of file gnn_node.c. |
|
||||||||||||
|
This function fills the input buffer w with the node's parameter values. Implementation Note: The parameter vector is build with the node's parameter bundle.
Definition at line 786 of file gnn_node.c. |
|
|
This function returns
Definition at line 766 of file gnn_node.c. |
|
||||||||||||
|
This function returns 1 if the i-th parameter is frozen.
Definition at line 896 of file gnn_node.c. |
|
||||||||||||
|
This function sets new values for the node's parameter vector. The new values are taken by the buffer w (of the correct size) given as input argument.
Definition at line 805 of file gnn_node.c. |
|
||||||||||||
|
This function share the node's parameters with the client node. @warning: This function should be called on nodes that aren't connected only.
Definition at line 966 of file gnn_node.c. |
|
||||||||||||
|
This function unfreezes the i-th parameter.
Definition at line 879 of file gnn_node.c. |
|
|
This function unfreezes all the node's parameters.
Definition at line 947 of file gnn_node.c. |
|
||||||||||||||||||||
|
This function sets the node's sizes for its input, output and parameter vector. It should be called after calling the gnn_node_init (and the gnn_node_sub_install in case of a constructor node) function.
Definition at line 1241 of file gnn_node.c. |
|
||||||||||||
|
This function returns a pointer to the i-th subnode.
Definition at line 1676 of file gnn_node.c. |
|
|
This function returns the number of direct subnodes of the node.
Definition at line 1659 of file gnn_node.c. |
|
||||||||||||||||
|
This function installs the given nodes as subnodes.
Definition at line 1554 of file gnn_node.c. |
|
||||||||||||
|
This function installs the non-NULL nodes in the node vector as subnodes.
Definition at line 1600 of file gnn_node.c. |
|
||||||||||||||||
|
This function installs the given nodes as subnodes.
Definition at line 1527 of file gnn_node.c. |
|
||||||||||||
|
This function searches the whole node three for nodes of the given type, and returns a parameter bundle of all their parameters.
Definition at line 1697 of file gnn_node.c. |
1.2.18