Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

gnn_serial : Serial Constructor for Function Composition.
[Constructor Nodes.]


Detailed Description

This node allows to stack nodes one on another. The resulting function is the composition of the node's subfunctions. That is, given functions in this order, the stack node forms the function

A new stack node can be built using the gnn_serial_new function.

Data Structures

struct  _gnn_serial
 gnn_serial : Serial Constructor for Function Composition. structure. More...

struct  _stack_buf
 Internal buffer structure. More...


Typedefs

typedef _stack_buf stack_buffer
 Internal buffer structure.

typedef _gnn_serial gnn_serial
 gnn_serial : Serial Constructor for Function Composition. structure.


Functions

int stack_buffer_init (stack_buffer *sb, size_t size)
 Initializes a stack buffer.

int stack_buffer_clear (stack_buffer *sb)
 Clears a stack buffer.

int stack_buffer_finalize (stack_buffer *sb)
 Finalizes a stack buffer.

int gnn_serial_make_buffers (gnn_node *node)
 Builds the buffers for a given gnn_serial : Serial Constructor for Function Composition. node.

int gnn_serial_destroy_buffers (gnn_node *node)
 Destroys a gnn_serial : Serial Constructor for Function Composition. node's stack buffers.

int gnn_serial_f (gnn_node *node, const gsl_vector *x, const gsl_vector *w, gsl_vector *y)
 Evaluate a stack node.

int gnn_serial_dx (gnn_node *node, const gsl_vector *x, const gsl_vector *w, const gsl_vector *dy, gsl_vector *dx)
 Computes for the doc.

int gnn_serial_dw (gnn_node *node, const gsl_vector *x, const gsl_vector *w, const gsl_vector *dy, gsl_vector *dw)
 Computes for the node.

void gnn_serial_destroy (gnn_node *node)
 gnn_serial : Serial Constructor for Function Composition. destructor.

gnn_nodegnn_serial_new (int size,...)
 Build a node stack.

gnn_nodegnn_serial_new_with_node_vector (gnn_node_vector *v)
 Build a node stack with a given node vector.

gnn_nodegnn_serial_get_node (gnn_node *node, int i)
 Get the i-th subnode.

int gnn_serial_get_size (gnn_node *node)
 Gets the number of nodes that the stack is build of.


Typedef Documentation

typedef struct _gnn_serial gnn_serial
 

This is the real structure for a gnn_serial : Serial Constructor for Function Composition. node. It needs to store additional information for managing the interfunction activity.

typedef struct _stack_buf stack_buffer
 

This structure stores the buffers needed for saving the intermediate results between the subfunction's evaluations.


Function Documentation

void gnn_serial_destroy gnn_node   node [static]
 

This function destroys the gnn_serial : Serial Constructor for Function Composition.'s specific data.

Parameters:
node  A pointer to a gnn_serial : Serial Constructor for Function Composition. node.

Definition at line 480 of file gnn_serial.c.

int gnn_serial_destroy_buffers gnn_node   node [static]
 

This function destroys the buffers for the current gnn_serial : Serial Constructor for Function Composition. node.

Parameters:
node  A pointer to a gnn_serial : Serial Constructor for Function Composition. structure.
Returns:
0 if suceeded.

Definition at line 278 of file gnn_serial.c.

int gnn_serial_dw gnn_node   node,
const gsl_vector *    x,
const gsl_vector *    w,
const gsl_vector *    dy,
gsl_vector *    dw
[static]
 

This function triggers the computation of the subnode's gradients involved in the sublayers .

Parameters:
node  A stack node.
x  The input vector .
w  The current parameter vector .
dy  The error-backpropagation vector
dw  Not used, since the stack hasn't any local parameters.
Returns:
0 if succeeded.

Definition at line 444 of file gnn_serial.c.

int gnn_serial_dx gnn_node   node,
const gsl_vector *    x,
const gsl_vector *    w,
const gsl_vector *    dy,
gsl_vector *    dx
[static]
 

This function computes the gradient as:

where where the input vectors involved in the subnode's functions .

Parameters:
node  A stack node.
x  The input vector .
w  The current parameter vector .
dy  The error-backpropagation vector
dx  An output vector where the result should be stored.
Returns:
0 if suceeded.

Definition at line 384 of file gnn_serial.c.

int gnn_serial_f gnn_node   node,
const gsl_vector *    x,
const gsl_vector *    w,
gsl_vector *    y
[static]
 

This function computes the result from the stack node. If its subnodes implement the functions then the result is given by

Parameters:
node  A stack node.
x  The input vector .
w  The current parameter vector .
y  An output vector where the result should be stored.
Returns:
0 if succeeded.

Definition at line 319 of file gnn_serial.c.

gnn_node* gnn_serial_get_node gnn_node   node,
int    i
 

This function returns a pointer to the stack's i-th node.

Parameters:
node  A stack node.
i  The node's index (should be within [0, size-1]).
Returns:
A pointer to the i-th node or NULL if failed.

Definition at line 666 of file gnn_serial.c.

int gnn_serial_get_size gnn_node   node
 

Parameters:
node  A stack node.
Returns:
Size of the stack.

Definition at line 679 of file gnn_serial.c.

int gnn_serial_make_buffers gnn_node   node [static]
 

This function takes a gnn_serial : Serial Constructor for Function Composition. node as argument, and builds the corresponding buffers for the installed subnodes.

Parameters:
node  A pointer to a gnn_serial : Serial Constructor for Function Composition. structure.
Returns:
0 if suceeded.

Definition at line 214 of file gnn_serial.c.

gnn_node* gnn_serial_new int    size,
...   
 

This function builds a new gnn_serial node. The node computes the function , where are the functions implemented by the subnodes given as arguments, in the same order.

The input and output sizes should match on each other, so that the output size of a preceeding node must be the same as the input size of the following node.

Example:

 gnn_node *stack, *node1, *node2, *node3;

 // build the nodes 1 to 3
 ...

 // build the stack
 stack = gnn_serial_new (3, node1, node2, node3);
Parameters:
size  The number of subnodes.
...  The list of subnodes.
Returns:
A new stack node.

Definition at line 523 of file gnn_serial.c.

gnn_node* gnn_serial_new_with_node_vector gnn_node_vector   v
 

This function builds a new gnn_serial node. The node computes the function , where are the functions implemented by the subnodes given as arguments, in the same order.

The input and output sizes should match on each other, so that the output size of a preceeding node must be the same as the input size of the following node.

Example:

 gnn_node *stack;
 gnn_node_vector *vector;

 // build the node vector
 vector = gnn_node_vector_new (3);

 // build the nodes vector[0], vector[1] and vector[2]
 ...

 // build the stack
 stack = gnn_serial_new_with_node_vector (vector);

Todo:
Automatic divergence-convergence insertion.
Parameters:
v  A pointer to a gnn_node_vector.
Returns:
A new stack node.

Definition at line 592 of file gnn_serial.c.

int stack_buffer_clear stack_buffer   sb [static]
 

This function resets the buffers to zero.

Parameters:
sb  A pointer to a gnn_serial : Serial Constructor for Function Composition. structure.
Returns:
0 if suceeded.

Definition at line 166 of file gnn_serial.c.

int stack_buffer_finalize stack_buffer   sb [static]
 

This function finalizes a gnn_serial : Serial Constructor for Function Composition., by freeing the memory associated to its buffer.

Parameters:
sb  A pointer to a gnn_serial : Serial Constructor for Function Composition. structure.
Returns:
0 if suceeded.

Definition at line 190 of file gnn_serial.c.

int stack_buffer_init stack_buffer   sb,
size_t    size
[static]
 

This function initializes a buffer of the given size.

Parameters:
sb  A pointer to a gnn_serial : Serial Constructor for Function Composition. structure.
size  The size of the buffers.
Returns:
0 if suceeded.

Definition at line 137 of file gnn_serial.c.


Generated on Sun Jun 13 20:51:44 2004 for libgnn Gradient Retropropagation Machine Library by doxygen1.2.18