setup neurons library and some script to test this lib
This commit is contained in:
+3
-4
@@ -70,10 +70,9 @@ $(DEPS):
|
|||||||
$(MAKE) -C $@ $(MAKECMDGOALS)
|
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||||
|
|
||||||
update_headers: $(PROJECT_LIB)
|
update_headers: $(PROJECT_LIB)
|
||||||
for file_h in $(DEPS); do
|
for file_h in $(DEPS); do \
|
||||||
cd ${file_h}/src
|
cd "$$file_h/src" ; \
|
||||||
#cp --parents "$$file_h/include/" include_neurons/; done
|
cp --parents */*.h $(INCLUDE_HEADERS_NEURONS)/ ; \
|
||||||
cp --parents "*/*.h" "$(INCLUDE_HEADERS_NEURONS)/" ;
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
#ifndef __DIMENSION_T__H__
|
||||||
|
#define __DIMENSION_T__H__
|
||||||
|
|
||||||
|
#include "permutation_t/permutation_t.h"
|
||||||
|
|
||||||
|
extern bool endian;
|
||||||
|
|
||||||
|
bool isLessEqThan(long int a, long int b) ;
|
||||||
|
bool isLessThan(long int a, long int b) ;
|
||||||
|
bool isGreatEqThan(long int a, long int b) ;
|
||||||
|
bool isGreatThan(long int a, long int b) ;
|
||||||
|
long int incr(long int i) ;
|
||||||
|
long int decr(long int i) ;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct PERMUTATION_TYPE_SIZE_T dimension ;
|
||||||
|
|
||||||
|
dimension * create_dim(size_t size);
|
||||||
|
dimension * create_reverse_dim(size_t size);
|
||||||
|
dimension* init_dim(size_t *t, size_t sz);
|
||||||
|
dimension* init_copy_dim(size_t *t, size_t sz);
|
||||||
|
dimension* clone_dim(dimension *dim);
|
||||||
|
void free_dimension(dimension *d);
|
||||||
|
|
||||||
|
bool is_equal_dim(dimension *d0, dimension *d1);
|
||||||
|
|
||||||
|
dimension* sub_minus_dim_head(dimension *t, size_t minusSubdim);
|
||||||
|
dimension* sub_minus_dim_tail(dimension *t, size_t minusSubdim);
|
||||||
|
dimension* sub_dim_head(dimension *t, size_t subdim);
|
||||||
|
dimension* sub_dim_tail(dimension *t, size_t subdim);
|
||||||
|
|
||||||
|
dimension* sub_copy_minus_dim_head(dimension *t, size_t minusSubdim);
|
||||||
|
dimension* sub_copy_minus_dim_tail(dimension *t, size_t minusSubdim);
|
||||||
|
dimension* sub_copy_dim_head(dimension *t, size_t sub_copydim);
|
||||||
|
dimension* sub_copy_dim_tail(dimension *t, size_t sub_copydim);
|
||||||
|
|
||||||
|
void split_dim_part(dimension *root, dimension **part_1, dimension **part_2, size_t pivotSplit, size_t rangeInPivot );
|
||||||
|
|
||||||
|
void add_copy_dimension(dimension **d, dimension *d0, dimension *d1);
|
||||||
|
void min_copy_dimension(dimension **d, dimension *d0, dimension *d1);
|
||||||
|
|
||||||
|
void add_dimension(dimension **d, dimension *d0, dimension *d1);
|
||||||
|
void min_dimension(dimension **d, dimension *d0, dimension *d1);
|
||||||
|
|
||||||
|
void printDebug_dimension(dimension *d, char *msg);
|
||||||
|
size_t sprint_dimension(char **dimContent, dimension *d);
|
||||||
|
|
||||||
|
void updateRankDim(dimension *dim);
|
||||||
|
size_t LineFromCoord(size_t *coo, dimension *dim);
|
||||||
|
size_t* CoordFromLin(size_t line, dimension *dim);
|
||||||
|
void vCoordFromLin(size_t *ret, size_t line, dimension *dim );
|
||||||
|
|
||||||
|
void increment_dim_var(dimension *d);
|
||||||
|
void decrement_dim_var(dimension *d);
|
||||||
|
|
||||||
|
struct list_perm_in_dim{
|
||||||
|
size_t index;
|
||||||
|
size_t perm;
|
||||||
|
struct list_perm_in_dim *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct list_perm_in_dim list_perm_in_dim;
|
||||||
|
|
||||||
|
void append_in_list_perm(list_perm_in_dim **list_p, size_t perm);
|
||||||
|
dimension * create_dim_from_list_perm( list_perm_in_dim *l_p);
|
||||||
|
|
||||||
|
void free_list_perm_in_dim(list_perm_in_dim *l_p);
|
||||||
|
|
||||||
|
#endif /* __DIMENSION_T__H__ */
|
||||||
|
//int compare_dimension(dimension *d1, dimension *d2);
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
#ifndef __NEURON_T_C__H
|
||||||
|
#define __NEURON_T_C__H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <semaphore.h>
|
||||||
|
|
||||||
|
//#include "tools_t/tools_t.h"
|
||||||
|
#include "tensor_t/tensor_t.h"
|
||||||
|
|
||||||
|
extern bool randomizeInitWeight;
|
||||||
|
|
||||||
|
struct config_layers{
|
||||||
|
size_t nb_layers;
|
||||||
|
size_t *sz_layers;
|
||||||
|
size_t **array_dim_in_layers;
|
||||||
|
};
|
||||||
|
typedef struct config_layers config_layers;
|
||||||
|
config_layers *create_config_layers(size_t nb_layers, size_t *sz_layers, size_t **array_dim_in_layers);
|
||||||
|
config_layers *create_config_layers_from_OneD(size_t nb_layers, size_t *array_dim_in_layers);
|
||||||
|
void free_config_layers(config_layers *pconf);
|
||||||
|
|
||||||
|
|
||||||
|
#define GEN_NEURON_(type)\
|
||||||
|
\
|
||||||
|
struct neurons_##type {/* layer */\
|
||||||
|
size_t id_layer;\
|
||||||
|
size_t iteration_step;\
|
||||||
|
size_t nb_prod_thread;\
|
||||||
|
size_t nb_calc_thread;\
|
||||||
|
type initial_learning_rate;\
|
||||||
|
type learning_rate;\
|
||||||
|
type decay_rate;\
|
||||||
|
size_t drop_rate;\
|
||||||
|
void (*update_learning_rate)(struct neurons_##type *N); \
|
||||||
|
tensor_##type *input; \
|
||||||
|
tensor_##type *net; /* output tensor_prodContract */\
|
||||||
|
tensor_##type *output; \
|
||||||
|
tensor_##type *target; \
|
||||||
|
tensor_##type *weight_in; /* weight link in */\
|
||||||
|
tensor_##type *bias; /* bias */\
|
||||||
|
tensor_##type *weight_out; /* weight link out */\
|
||||||
|
tensor_##type *delta_out; /* delta */\
|
||||||
|
struct neurons_##type *prev_layer;\
|
||||||
|
struct neurons_##type *next_layer;\
|
||||||
|
void (*TensorContraction)(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t contractionNumber, size_t nbthread);/* nbthread is ignored if not required ! */\
|
||||||
|
void (*TensorProduct)(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t nbthread);/* nbthread is ignored if not required ! */\
|
||||||
|
type (*dL)(type t, type o);\
|
||||||
|
type (*L)(type t, type o);\
|
||||||
|
type (*f_act)(type x);\
|
||||||
|
type (*d_f_act)(type x);\
|
||||||
|
};\
|
||||||
|
typedef struct neurons_##type neurons_##type;\
|
||||||
|
\
|
||||||
|
struct func_act_##type {\
|
||||||
|
type (*func_act)(type x); /* function activation */\
|
||||||
|
type (*deriv_func_act)(type x); /* derivate func act */\
|
||||||
|
};\
|
||||||
|
\
|
||||||
|
void do_not_update_learnig_rate_##type(neurons_##type *N);\
|
||||||
|
void time_based_update_learning_rate_##type(neurons_##type *nr);\
|
||||||
|
void step_based_update_learning_rate_##type(neurons_##type *nr);\
|
||||||
|
void setup_learning_rate_params_neurons_##type(neurons_##type *base,type initial_learning_rate, type decay_rate, size_t drop_rate, void (*update_learning_rate)(neurons_##type *));\
|
||||||
|
/*void calc_net_neurons_##type(neurons_##type *nr);*/\
|
||||||
|
void calc_out_neurons_##type(neurons_##type *nr);\
|
||||||
|
void calc_delta_neurons_##type(neurons_##type *nr);\
|
||||||
|
void update_weight_neurons_##type(neurons_##type *nr);\
|
||||||
|
/*void setup_networks_##type(neurons_##type **base_nr, size_t **array_dim_in_layers, size_t *tab_sz_layers, size_t nb_layers);*/\
|
||||||
|
void init_copy_in_out_networks_from_tensors_##type(neurons_##type *nr, tensor_##type *input, tensor_##type *target);\
|
||||||
|
void init_in_out_networks_from_tensors_##type(neurons_##type *nr, tensor_##type *input, tensor_##type *target, neurons_##type *base);\
|
||||||
|
void init_in_out_all_networks_##type(neurons_##type *nr, tensor_##type *in, tensor_##type *out);\
|
||||||
|
void setup_networks_alloutputs_GLOBAL_rdm01_##type(neurons_##type **base_nr, size_t **array_dim_in_layers, size_t *sz_layers, size_t nb_layers);\
|
||||||
|
void setup_networks_alloutputs_##type(neurons_##type **base_nr, size_t **array_dim_in_layers, size_t *sz_layers, size_t nb_layers, bool randomize, type minR, type maxR, int randomRange);\
|
||||||
|
void setup_networks_alloutputs_config_##type(neurons_##type **base_nr, config_layers *lconf, bool randomize, type minR, type maxR, int randomRange);\
|
||||||
|
void setup_networks_layers_without_weights_##type(neurons_##type **base_nr, size_t **array_dim_in_layers, size_t *sz_layers, size_t nb_layers);\
|
||||||
|
void setup_networks_layers_without_weights_from_config_##type(neurons_##type **base, config_layers *pconf);\
|
||||||
|
void setup_networks_OneD_##type(neurons_##type **base_nr, size_t *array_dim_in_layers, size_t nb_layers, bool randomize, type minR, type maxR, int randomRange);\
|
||||||
|
void init_in_out_all_networks_OneD_##type(neurons_##type *nr, type *in, size_t sz_in, type *out, size_t sz_out);\
|
||||||
|
void print_neurons_msg_##type(neurons_##type *nr, char * msg);\
|
||||||
|
\
|
||||||
|
void free_neurons_##type(neurons_##type *base);\
|
||||||
|
\
|
||||||
|
void setup_all_layers_functions_##type(neurons_##type *base, \
|
||||||
|
void (*TensorContraction)(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t contractionNumber, size_t nbthread),/* nbthread is ignored if not required ! */\
|
||||||
|
void (*TensorProduct)(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t nbthread),/* nbthread is ignored if not required ! */\
|
||||||
|
type (*dL)(type t, type o),\
|
||||||
|
type (*L)(type t, type o),\
|
||||||
|
type (*f_act)(type x),\
|
||||||
|
type (*d_f_act)(type x)\
|
||||||
|
);\
|
||||||
|
void setup_all_layers_params_##type(neurons_##type *base,\
|
||||||
|
size_t nb_prod_thread,\
|
||||||
|
size_t nb_calc_thread,\
|
||||||
|
type learning_rate);\
|
||||||
|
type error_out_##type(neurons_##type *base);\
|
||||||
|
struct data_set_##type{\
|
||||||
|
size_t size;\
|
||||||
|
tensor_##type **input;\
|
||||||
|
tensor_##type **target;\
|
||||||
|
};\
|
||||||
|
typedef struct data_set_##type data_set_##type;\
|
||||||
|
void free_data_set_##type(data_set_##type *ds);\
|
||||||
|
data_set_##type* fill_data_set_from_file_##type(char * file_input, size_t pivotSplit);\
|
||||||
|
void print_data_set_msg_##type(data_set_##type *ds, char *msg);\
|
||||||
|
\
|
||||||
|
size_t learning_online_neurons_##type(neurons_##type *base, data_set_##type *dataset, bool (*condition)(type, size_t));\
|
||||||
|
size_t learning_online2_neurons_##type(neurons_##type *base, data_set_##type *dataset, bool (*condition)(type, size_t));\
|
||||||
|
\
|
||||||
|
void print_predict_by_network_neurons_##type(neurons_##type *base, tensor_##type *input);\
|
||||||
|
void print_predict_by_network_with_error_neurons_##type(neurons_##type *base, tensor_##type *input, tensor_##type *target);\
|
||||||
|
\
|
||||||
|
struct cloneuronset_##type{\
|
||||||
|
size_t nb_clone;\
|
||||||
|
config_layers *conf;\
|
||||||
|
neurons_##type *base;\
|
||||||
|
neurons_##type **cloneurons;\
|
||||||
|
};\
|
||||||
|
typedef struct cloneuronset_##type cloneuronset_##type;\
|
||||||
|
void free_cloneuronset_##type(cloneuronset_##type *clnrnst);\
|
||||||
|
cloneuronset_##type * create_cloneuronset_from_base_conf_##type(neurons_##type *base, config_layers *conf, size_t nb_clone);\
|
||||||
|
size_t learning_cloneuronset_##type(cloneuronset_##type *clnrnst, data_set_##type *dataset, bool (*condition)(type, size_t));\
|
||||||
|
|
||||||
|
GEN_NEURON_(TYPE_FLOAT)
|
||||||
|
GEN_NEURON_(TYPE_DOUBLE)
|
||||||
|
|
||||||
|
|
||||||
|
#endif /*__NEURON_T_C__H*/
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#ifndef __PERMUTATION_T_C_H__
|
||||||
|
#define __PERMUTATION_T_C_H__
|
||||||
|
|
||||||
|
#include "tools_t/tools_t.h"
|
||||||
|
#include "set_theoric_t/set_theoric_t.h"
|
||||||
|
|
||||||
|
/* struct of permutation, not necessarly set_theoric
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define GENERATE_PERMUTATION(type)\
|
||||||
|
struct PERMUTATION_##type{\
|
||||||
|
size_t size;\
|
||||||
|
size_t rank;\
|
||||||
|
type * perm; \
|
||||||
|
};\
|
||||||
|
\
|
||||||
|
typedef struct PERMUTATION_##type PERMUTATION_##type;\
|
||||||
|
PERMUTATION_##type * CREATE_PERMUTATION_##type(size_t size);\
|
||||||
|
PERMUTATION_##type * INIT_PERMUTATION_##type(type *perm, size_t size);\
|
||||||
|
PERMUTATION_##type * INIT_COPY_PERMUTATION_##type(type *perm, size_t size);\
|
||||||
|
void free_permut_##type(PERMUTATION_##type * permut);\
|
||||||
|
PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(const PERMUTATION_##type *p );\
|
||||||
|
bool IS_PERMUTATION_##type(const PERMUTATION_##type *p );\
|
||||||
|
size_t TabToPlaceAlgo_##type(const PERMUTATION_##type *p);\
|
||||||
|
size_t TabToPlaceOpt1_##type(const PERMUTATION_##type *p);\
|
||||||
|
size_t TabToPlaceNotab_##type(const PERMUTATION_##type *p);\
|
||||||
|
PERMUTATION_TYPE_SIZE_T * PlaceToTab_##type(PERMUTATION_##type *p, size_t pl);\
|
||||||
|
|
||||||
|
GENERATE_PERMUTATION(TYPE_SIZE_T)
|
||||||
|
GENERATE_PERMUTATION(TYPE_CHAR)
|
||||||
|
GENERATE_PERMUTATION(TYPE_U_CHAR)
|
||||||
|
GENERATE_PERMUTATION(TYPE_INT)
|
||||||
|
GENERATE_PERMUTATION(TYPE_U_INT)
|
||||||
|
GENERATE_PERMUTATION(TYPE_L_INT)
|
||||||
|
GENERATE_PERMUTATION(TYPE_U_L_INT)
|
||||||
|
GENERATE_PERMUTATION(TYPE_FLOAT)
|
||||||
|
GENERATE_PERMUTATION(TYPE_DOUBLE)
|
||||||
|
GENERATE_PERMUTATION(TYPE_L_DOUBLE)
|
||||||
|
GENERATE_PERMUTATION(TYPE_STRING)
|
||||||
|
|
||||||
|
#define GENERATE_FUNCTIONS_UNSIGNED(type)\
|
||||||
|
bool IS_PERMUTATION_SET_THEORIC_##type(const PERMUTATION_##type *p);\
|
||||||
|
|
||||||
|
GENERATE_FUNCTIONS_UNSIGNED(TYPE_U_CHAR)
|
||||||
|
GENERATE_FUNCTIONS_UNSIGNED(TYPE_U_INT)
|
||||||
|
GENERATE_FUNCTIONS_UNSIGNED(TYPE_U_L_INT)
|
||||||
|
GENERATE_FUNCTIONS_UNSIGNED(TYPE_SIZE_T)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /*__PERMUTATION_T_C_H__*/
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef __SET_THEORIC_T_C__H
|
||||||
|
#define __SET_THEORIC_T_C__H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "tools_t/tools_t.h"
|
||||||
|
|
||||||
|
#define GENERATE_UNSIGNED_SET_THEORIC(type) \
|
||||||
|
struct SET_THEORIC_##type{ \
|
||||||
|
type id; \
|
||||||
|
type *set; \
|
||||||
|
}; \
|
||||||
|
typedef struct SET_THEORIC_##type SET_THEORIC_##type; \
|
||||||
|
SET_THEORIC_##type * CREATE_SET_THEORIC_##type(size_t id/*TYPE_##type*/); \
|
||||||
|
bool IS_SET_THEORIC_##type(SET_THEORIC_##type *st); \
|
||||||
|
|
||||||
|
GENERATE_UNSIGNED_SET_THEORIC(TYPE_U_CHAR)
|
||||||
|
GENERATE_UNSIGNED_SET_THEORIC(TYPE_U_INT)
|
||||||
|
GENERATE_UNSIGNED_SET_THEORIC(TYPE_U_L_INT)
|
||||||
|
GENERATE_UNSIGNED_SET_THEORIC(TYPE_SIZE_T)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /*__SET_THEORIC_T_C__H*/
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef __CL_TENSOR_T__H__
|
||||||
|
#define __CL_TENSOR_T__H__
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define CL_TARGET_OPENCL_VERSION 300
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <OpenCL/opencl.h>
|
||||||
|
#else
|
||||||
|
#include <CL/cl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "tensor_t/tensor_t.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define CL_GENERATE_TENSOR_TYPE(type) \
|
||||||
|
void cl_tensorProd_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1); \
|
||||||
|
void cl_tensorContractnProd_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t contractionNumber); \
|
||||||
|
void cl2d_tensorProd_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t div0Wsz, size_t div1Wsz); \
|
||||||
|
void cl2d_tensorContractnProd_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t contractionNumber, size_t div0Wsz, size_t div1Wsz); \
|
||||||
|
|
||||||
|
CL_GENERATE_TENSOR_TYPE(TYPE_FLOAT);
|
||||||
|
CL_GENERATE_TENSOR_TYPE(TYPE_DOUBLE);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __CL_TENSOR_T__H__ */
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
#ifndef __TENSOR_T__H__
|
||||||
|
#define __TENSOR_T__H__
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#include "dimension_t/dimension_t.h"
|
||||||
|
|
||||||
|
void subArray(size_t* dst, size_t* src, size_t debDst, size_t finDst, size_t debSrc);
|
||||||
|
|
||||||
|
#define GENERATE_TENSOR_TYPE(type) \
|
||||||
|
struct tensor_##type{\
|
||||||
|
dimension *dim;\
|
||||||
|
type *x;\
|
||||||
|
};\
|
||||||
|
typedef struct tensor_##type tensor_##type;\
|
||||||
|
tensor_##type * CREATE_TENSOR_##type(dimension *dim); \
|
||||||
|
tensor_##type* CREATE_TENSOR_FROM_CPY_DIM_##type(dimension *dim);\
|
||||||
|
void _RECREATE_TENSOR_IF_NOT_THE_SAME_DIM_OR_NULL_##type(tensor_##type **M, dimension *dd);\
|
||||||
|
tensor_##type* CLONE_TENSOR_##type(tensor_##type *tens);\
|
||||||
|
void free_tensor_##type(tensor_##type * tens); \
|
||||||
|
tensor_##type * sub_minus_tensor_head_##type(tensor_##type *rootens, size_t minuSubdim, size_t rankInDim); \
|
||||||
|
tensor_##type * sub_minus_tensor_tail_##type(tensor_##type *rootens, size_t minuSubdim, size_t rankInDim); \
|
||||||
|
tensor_##type * sub_tensor_head_##type(tensor_##type *rootens, size_t subdim, size_t rankInDim); \
|
||||||
|
tensor_##type * sub_tensor_tail_##type(tensor_##type *rootens, size_t subdim, size_t rankInDim); \
|
||||||
|
tensor_##type * sub_copy_minus_tensor_head_##type(tensor_##type *rootens, size_t minuSubdim, size_t rankInDim); \
|
||||||
|
tensor_##type * sub_copy_minus_tensor_tail_##type(tensor_##type *rootens, size_t minuSubdim, size_t rankInDim); \
|
||||||
|
tensor_##type * sub_copy_tensor_head_##type(tensor_##type *rootens, size_t sub_copydim, size_t rankInDim); \
|
||||||
|
tensor_##type * sub_copy_tensor_tail_##type(tensor_##type *rootens, size_t sub_copydim, size_t rankInDim); \
|
||||||
|
void print_tensor_msg_##type(tensor_##type *T, char *msg);\
|
||||||
|
void fprint_tensor_##type(char *file_name, tensor_##type *T);\
|
||||||
|
size_t sprint_tensor_##type(char **tensorContent,tensor_##type *T, bool withIndex);\
|
||||||
|
void split_tensor_##type(tensor_##type *Troot, tensor_##type **Tpart1, tensor_##type **Tpart2, size_t pivotSplit, size_t rangeInPivot);\
|
||||||
|
void split_copy_tensor_##type(tensor_##type *Troot, tensor_##type **Tpart1, tensor_##type **Tpart2, size_t pivotSplit, size_t rangeInPivot);\
|
||||||
|
void tensorProdNotOpt_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1); \
|
||||||
|
void tensorProd_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1); \
|
||||||
|
void tensorContractnProd_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t contractionNumber); \
|
||||||
|
void tensorProdThread_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1,size_t nbthread); \
|
||||||
|
void tensorProdThrea2d_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1,size_t nbthread); \
|
||||||
|
void tensorContractnProdThread_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t contractionNumber, size_t nbthread); \
|
||||||
|
void tensorContractnPro2dThread_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t contractionNumber, size_t nbthread); \
|
||||||
|
void tensorContractnProdNotOpt_##type(tensor_##type **MM, tensor_##type *M0, tensor_##type *M1, size_t contractionNumber); \
|
||||||
|
void init_random_x_##type(tensor_##type *M, type minR, type maxR, int randomRange);\
|
||||||
|
tensor_##type * parseInput_withDim_to_tensor_##type(char *input);\
|
||||||
|
void parseInputOutput_withDim_to_tensors_##type(tensor_##type **Tpart1, tensor_##type **Tpart2, char *input, size_t pivotSplit);\
|
||||||
|
void parse_file_InputOutput_withDim_to_tensors_##type(tensor_##type **Tpart1, tensor_##type **Tpart2, char *file_name_input, size_t pivotSplit);\
|
||||||
|
tensor_##type ** fromInput_to_array_tensor_##type(tensor_##type *tens);\
|
||||||
|
struct array_chainlist_##type{\
|
||||||
|
size_t index;\
|
||||||
|
type x;\
|
||||||
|
struct array_chainlist_##type *next;\
|
||||||
|
};\
|
||||||
|
typedef struct array_chainlist_##type array_chainlist_##type;\
|
||||||
|
void append_array_chainlist_##type(array_chainlist_##type **list_a, type x);\
|
||||||
|
tensor_##type * create_tensor_from_list_array_##type( array_chainlist_##type *l_a, dimension *part_dim);\
|
||||||
|
void free_array_chainlist_##type(array_chainlist_##type *l_a);\
|
||||||
|
tensor_##type * transpose_notOpt_tensor_##type(tensor_##type *org);\
|
||||||
|
tensor_##type * permute_notOpt_tensor_##type(tensor_##type *org, dimension *dperm);\
|
||||||
|
void update_1tensor_func_##type(tensor_##type *M0, \
|
||||||
|
type (*func)(type), size_t nbthread);\
|
||||||
|
void update_2tensor_func_##type(tensor_##type *M0, tensor_##type *M1, \
|
||||||
|
type (*func)(type), size_t nbthread);\
|
||||||
|
void update_3tensor_func_##type(tensor_##type *M0, tensor_##type *M1, tensor_##type *M2, \
|
||||||
|
type (*func)(type, type), size_t nbthread);\
|
||||||
|
void update_4tensor_func_##type(tensor_##type *M0, tensor_##type *M1, tensor_##type *M2, \
|
||||||
|
type (*func)(type, type, type(*f1)(type)),\
|
||||||
|
type(*f1)(type),\
|
||||||
|
size_t nbthread);\
|
||||||
|
void update_5tensor_func_##type(tensor_##type *M0, tensor_##type *M1, tensor_##type *M2, tensor_##type *M3 , \
|
||||||
|
type (*func) (type, type, type, type(*f1)(type), type (*f2)(type,type)), \
|
||||||
|
type(*f1)(type), \
|
||||||
|
type (*f2)(type,type), \
|
||||||
|
size_t nbthread);\
|
||||||
|
void update_6tensor_func_##type(tensor_##type *M0, tensor_##type *M1, \
|
||||||
|
type (*func)(type, type, type),\
|
||||||
|
type scalar,\
|
||||||
|
size_t nbthread);\
|
||||||
|
|
||||||
|
|
||||||
|
GENERATE_TENSOR_TYPE(TYPE_FLOAT);
|
||||||
|
GENERATE_TENSOR_TYPE(TYPE_DOUBLE);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __TENSOR_T__H__ */
|
||||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
gcc -o c_launch is_good.c -I../include_neurons/include/ -L.. -L../../ytest_t/ -lneurons -lytest -lpthread -lm
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH=..:../../ytest_t/ ./c_launch
|
||||||
Reference in New Issue
Block a user