code :newBrain
定义dtype
#define dtype float
typedef unsigned int uint;
typedef unsigned char uchar;
typedef struct
{
dtype* data;
uint b;
uint c;
uint h;
uint w;
}BLOB4;
在一个结构里面定义函数指针
> typedef void*(*FUNCTION)(void*);
> FUNCTION run;
> int (*forward)(struct Layer*);
typedef struct layer Layer;
typedef struct
{
char* name;
LayerType type;
FUNCTION forward;
Weight* weight;
BLOB4* output;
BLOB4* input;
}Layer;
typedef struct WEIGHT
{
dtype *weight;
dtype *bias;
#ifdef USE_GPU
cldata* gpu;
#endif
uint out_c;
uint in_c;
uint k_h;
uint k_w;
}Weight;