y_nnn: debug learning: bash_print_neuron

This commit is contained in:
2025-11-28 18:45:54 +01:00
parent 3daabbe634
commit cc79d8c524
2 changed files with 24 additions and 0 deletions
+22
View File
@@ -164,5 +164,27 @@ GEN_NEURON_(TYPE_DOUBLE)
free(vmsg);\
}while(0);\
#define BASH_PRINT_ATTRIBUTE_TENS_IN_ALL_LAYERS(type, bash_arg, neuronVar, attribute, msg)\
do{\
neurons_##type *tmpn = neuronVar;\
char *vmsg=malloc(strlen(msg)+70);\
size_t i=0;\
size_t lenVMG=0;\
size_t lenBSH_T=0;\
while(tmpn){\
lenVMG = sprintf(vmsg,"%s layer %ld",msg,i++);\
BASH_WRITE_IF_EXIST(bash_arg,vmsg,lenVMG);\
if(tmpn->attribute){\
char *bashSTR=NULL;\
lenBSH_T=sprint_tensor_##type(&bashSTR, tmpn->attribute, true);\
BASH_WRITE_IF_EXIST(bash_arg,bashSTR,lenBSH_T);\
if(bashSTR) free(bashSTR);\
}\
tmpn = tmpn->next_layer;\
}\
free(vmsg);\
}while(0);\
#endif /*__NEURON_T_C__H*/
@@ -158,6 +158,8 @@ void* runBashPrint(void *arg){
//PRINT_ATTRIBUTE_TENS_IN_ALL_LAYERS(TYPE_FLOAT, net_target, output, "net_target_out");
//PRINT_ATTRIBUTE_TENS_IN_ALL_LAYERS(TYPE_FLOAT, net_main, input, "net_main_input");
////printf(" action : %d , factor : %f nb_episodes : %ld \n",qlStatus->action,rlAgent->qlearnParams->exploration_factor, rlAgent->status->nb_episodes);
BASH_PRINT_ATTRIBUTE_TENS_IN_ALL_LAYERS(TYPE_FLOAT, bash_arg, net_main, weight_in, "net_main_we_in");
len_buf=sprintf(buf," action : %d , factor : %f nb_episodes : %ld \n",qlStatus->action,rlAgent->qlearnParams->exploration_factor, rlAgent->status->nb_episodes);
BASH_WRITE_IF_EXIST(bash_arg, buf, len_buf)