learn_to_drive: add up threshold in reLU to avoid NaN in neuron weight calc

This commit is contained in:
2025-11-28 20:53:04 +01:00
parent cc79d8c524
commit 32207170f6
2 changed files with 4 additions and 2 deletions
@@ -2,14 +2,16 @@
char *action_name[8] = {"LEFT", "CENTER", "RIGHT"};
#define THRESHOLD_UP 10
float reLU(float x){
// if(x>10) return 10;
if(x>THRESHOLD_UP) return THRESHOLD_UP;
if(x>0) return x;
return 0;
}
float d_reLU(float x){
// if (x>10) return 0;
if (x>THRESHOLD_UP) return 0;
if (x>0) return 1;
return 0;
}