SPRAAK
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
API_SprLibInternal::lib::nn
+ Collaboration diagram for API_SprLibInternal::lib::nn:

Data Structures

struct  SprNNOpInfo
 
union  _Union1_NN_MAIN_
 
struct  SprNNOp
 one operation on the connections More...
 
struct  SprNNLayer
 a NN layer More...
 
struct  SprNNConnect
 connection between layers (contains operations) More...
 
union  SprNNIDo
 
struct  _Struct3_NN_MAIN_
 
struct  SprNNIWS
 the NN interface work space More...
 

Macros

#define SPR_NN_OP_MAX
 
#define SPR_NN_OP_REQ_I(CB_flags)
 
#define SPR_NN_OP_REQ_O(CB_flags)
 

Typedefs

typedef SprNNFltS(* SprNNfwdS) (SprNNFltS x, char *restrict p)
 
typedef SprNNFltV(* SprNNfwdV) (SprNNFltV x, char *restrict p)
 
typedef SprNNFltS(* SprNNbwdPS) (SprNNFltS dE, void *restrict p)
 
typedef SprNNFltV(* SprNNbwdPV) (SprNNFltV dE, void *restrict p)
 
typedef SprNNFltS(* SprNNbwdBS) (SprNNFltS x, void *restrict p)
 bwd evaluation, compute dp, process one scalar input element More...
 
typedef SprNNFltV(* SprNNbwdBV) (SprNNFltV x, void *restrict p)
 bwd evaluation, compute dp, process one vector input element More...
 
typedef SprNNOp *(* SprNNmodif) (SprNNOp *restrict op)
 change behavior based on the arguments and based on the next operation More...
 
typedef int(* SprNNfast) (const SprNNConnect *restrict connect, unsigned int flags, SprNNIWS *ws)
 change behavior based on the arguments and based on the next operation More...
 
typedef int(* SprNNIDoFunc) (const SprNNIDo *restrict args, int pos)
 

Enumerations

enum  { SPR_NN_SSP_READ }
 
enum  {
  SPR_NN_CT_DIRECT, SPR_NN_CT_FULL, SPR_NN_CT_SPARSE, SPR_NN_CT_SELECT,
  SPR_NN_CT_TREE, SPR_NN_CT_WEIGTH, SPR_NN_CT_MERGE
}
 
enum  {
  SPR_NN_OP_C, SPR_NN_OP_B, SPR_NN_OP_T, SPR_NN_OP_P,
  SPR_NN_OP_HAVE_PARAM
}
 
enum  { SPR_NN_OP_I, SPR_NN_OP_O }
 
enum  { SPR_NN_OP_NOP }
 
enum  {
  SPR_NN_OP_REPLACE_PARAM, SPR_NN_OP_INT, SPR_NN_OP_DEF_VAL, SPR_NN_OP_REQUIRED_PARAM,
  SPR_NN_OP_DEF_VAL_P0, SPR_NN_OP_DEF_VAL_P1, SPR_NN_OP_DEF_VAL_P2, SPR_NN_OP_DEF_VAL_M1,
  SPR_NN_OP_DEF_VAL_PH, SPR_NN_OP_DEF_VAL_MSK, SPR_NN_OP_ARG_END
}
 
enum  { SPR_NN_LAYER_BIAS, SPR_NN_LAYER_GRAD, SPR_NN_LAYER_INPUT, SPR_NN_LAYER_OUTPUT }
 
enum  { SPR_NNI_DO_EVAL, SPR_NNI_DO_TRAIN_FWD, SPR_NNI_DO_TRAIN_BWD, SPR_NNI_DO_ARGS }
 

Functions

int spr_nn_rw_param (SprNNOp *restrict op, SprStream *restrict fd, int do_write, int sz1, int sz2, int *sz_sparse)
 
void * spr_nni_get_const_space (SprNNIWS *restrict ws, int vec, int sz)
 
void spr_nni_unget_code_space (SprNNIWS *restrict ws, int sz)
 Give the last sz code elements back to the buffer. More...
 
SprNNIDo * spr_nni_get_code_space (SprNNIWS *restrict ws, int sz)
 

Variables

const SprNNOpInfo spr_nn_op_info []
 

Detailed Description

Macro Definition Documentation

§ SPR_NN_OP_MAX

#define SPR_NN_OP_MAX

§ SPR_NN_OP_REQ_I

#define SPR_NN_OP_REQ_I (   CB_flags)

§ SPR_NN_OP_REQ_O

#define SPR_NN_OP_REQ_O (   CB_flags)

Typedef Documentation

§ SprNNfwdS

typedef SprNNFltS(* SprNNfwdS) (SprNNFltS x, char *restrict p)

fwd evaluation, process one scalar input element; p is advanced by the caller

§ SprNNfwdV

typedef SprNNFltV(* SprNNfwdV) (SprNNFltV x, char *restrict p)

fwd evaluation, process one vector input element; p is advanced by the caller

§ SprNNbwdPS

typedef SprNNFltS(* SprNNbwdPS) (SprNNFltS dE, void *restrict p)

bwd evaluation, compute dp and dx, process one scalar input element

§ SprNNbwdPV

typedef SprNNFltV(* SprNNbwdPV) (SprNNFltV dE, void *restrict p)

bwd evaluation, compute dp and dx, process one vector input element

§ SprNNbwdBS

typedef SprNNFltS(* SprNNbwdBS) (SprNNFltS x, void *restrict p)

bwd evaluation, compute dp, process one scalar input element

§ SprNNbwdBV

typedef SprNNFltV(* SprNNbwdBV) (SprNNFltV x, void *restrict p)

bwd evaluation, compute dp, process one vector input element

§ SprNNmodif

typedef SprNNOp*(* SprNNmodif) (SprNNOp *restrict op)

change behavior based on the arguments and based on the next operation

return NULL on ERROR, sets the 'next' pointer to NULL if merged with the next op

§ SprNNfast

typedef int(* SprNNfast) (const SprNNConnect *restrict connect, unsigned int flags, SprNNIWS *ws)

change behavior based on the arguments and based on the next operation

return NULL on ERROR, sets the 'next' pointer to NULL if merged with the next op

§ SprNNIDoFunc

typedef int(* SprNNIDoFunc) (const SprNNIDo *restrict args, int pos)

Enumeration Type Documentation

§ anonymous enum

anonymous enum
Enumerator
SPR_NN_SSP_READ 

read config lines using the ssp reader

§ anonymous enum

anonymous enum
Enumerator
SPR_NN_CT_DIRECT 
SPR_NN_CT_FULL 
SPR_NN_CT_SPARSE 
SPR_NN_CT_SELECT 
SPR_NN_CT_TREE 
SPR_NN_CT_WEIGTH 
SPR_NN_CT_MERGE 

§ anonymous enum

anonymous enum
Enumerator
SPR_NN_OP_C 

the params are not trainable (constant)

SPR_NN_OP_B 

do not propgate (block) the gradient info

SPR_NN_OP_T 

the params are trainable (default, flag only used to check conflict with setting both T and C)

SPR_NN_OP_P 

propagate the gradient info (default, flag only used to check conflict with setting both P and B)

SPR_NN_OP_HAVE_PARAM 

SPR_NN_OP_HAVE_PARAM: set of bit flags, one per param.

§ anonymous enum

anonymous enum
Enumerator
SPR_NN_OP_I 

computing the gradients requires the input value (4 flags, based on the C/B flags)

SPR_NN_OP_O 

computing the gradients requires the output value (4 flags, based on the C/B flags)

§ anonymous enum

anonymous enum
Enumerator
SPR_NN_OP_NOP 

this is the NOP op

§ anonymous enum

anonymous enum
Enumerator
SPR_NN_OP_REPLACE_PARAM 

this parameter replaces one of the trainable parameters

SPR_NN_OP_INT 

the parameters is an integer option

SPR_NN_OP_DEF_VAL 
SPR_NN_OP_REQUIRED_PARAM 

if parameters are given (<op>() construct), then this param must be specified (does not have a default value)

SPR_NN_OP_DEF_VAL_P0 

default value: 0.0

SPR_NN_OP_DEF_VAL_P1 

default value: 1.0

SPR_NN_OP_DEF_VAL_P2 

default value: 2.0

SPR_NN_OP_DEF_VAL_M1 

default value: -1.0

SPR_NN_OP_DEF_VAL_PH 

default value: 0.5

SPR_NN_OP_DEF_VAL_MSK 

default value mask

SPR_NN_OP_ARG_END 

§ anonymous enum

anonymous enum
Enumerator
SPR_NN_LAYER_BIAS 

bias is used

SPR_NN_LAYER_GRAD 

gradient information is reaching this layer (TODO)

SPR_NN_LAYER_INPUT 

layer is an input layer

SPR_NN_LAYER_OUTPUT 

layer is an output layer

§ anonymous enum

anonymous enum
Enumerator
SPR_NNI_DO_EVAL 
SPR_NNI_DO_TRAIN_FWD 
SPR_NNI_DO_TRAIN_BWD 
SPR_NNI_DO_ARGS 

Function Documentation

§ spr_nn_rw_param()

int spr_nn_rw_param ( SprNNOp *restrict  op,
SprStream *restrict  fd,
int  do_write,
int  sz1,
int  sz2,
int *  sz_sparse 
)

Read (or write if the do_write flag is set) all parameters for the given sequence of operations op from the data stream fd. The topology of the connection is encoded in sz1, sz2, and sz_sparse as follows:

  • if both sz1 and sz2 are positive numbers, then read a matrix/vector
  • TODO
Returns
(-1) on error, 0 if no parameters were read and 1 otherwise.

§ spr_nni_get_const_space()

void* spr_nni_get_const_space ( SprNNIWS *restrict  ws,
int  vec,
int  sz 
)

Get a pointer to a free block of constants that can hold sz scalars (vec==0) or sz vectors (vec!=0) and that is properly aligned.

Returns
NULL or error and a pointer to the constant block otherwise

§ spr_nni_unget_code_space()

void spr_nni_unget_code_space ( SprNNIWS *restrict  ws,
int  sz 
)

Give the last sz code elements back to the buffer.

§ spr_nni_get_code_space()

SprNNIDo* spr_nni_get_code_space ( SprNNIWS *restrict  ws,
int  sz 
)

Make room for sz code elements in the buffer.

Returns
NULL or error and a pointer to the op_code block otherwise

Variable Documentation

§ spr_nn_op_info

const SprNNOpInfo spr_nn_op_info[]