| | |
| | | return "leaky"; |
| | | case STAIR: |
| | | return "stair"; |
| | | case HARDTAN: |
| | | return "hardtan"; |
| | | case LHTAN: |
| | | return "lhtan"; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | if (strcmp(s, "elu")==0) return ELU; |
| | | if (strcmp(s, "relie")==0) return RELIE; |
| | | if (strcmp(s, "plse")==0) return PLSE; |
| | | if (strcmp(s, "hardtan")==0) return HARDTAN; |
| | | if (strcmp(s, "lhtan")==0) return LHTAN; |
| | | if (strcmp(s, "linear")==0) return LINEAR; |
| | | if (strcmp(s, "ramp")==0) return RAMP; |
| | | if (strcmp(s, "leaky")==0) return LEAKY; |
| | |
| | | return plse_activate(x); |
| | | case STAIR: |
| | | return stair_activate(x); |
| | | case HARDTAN: |
| | | return hardtan_activate(x); |
| | | case LHTAN: |
| | | return lhtan_activate(x); |
| | | } |
| | | return 0; |
| | | } |
| | |
| | | void activate_array(float *x, const int n, const ACTIVATION a) |
| | | { |
| | | int i; |
| | | for(i = 0; i < n; ++i){ |
| | | x[i] = activate(x[i], a); |
| | | if (a == LINEAR) {} |
| | | else if (a == LEAKY) { |
| | | for (i = 0; i < n; ++i) { |
| | | x[i] = leaky_activate(x[i]); |
| | | } |
| | | } |
| | | else { |
| | | for (i = 0; i < n; ++i) { |
| | | x[i] = activate(x[i], a); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | return plse_gradient(x); |
| | | case STAIR: |
| | | return stair_gradient(x); |
| | | case HARDTAN: |
| | | return hardtan_gradient(x); |
| | | case LHTAN: |
| | | return lhtan_gradient(x); |
| | | } |
| | | return 0; |
| | | } |
| | |
| | | for(i = 0; i < n; ++i){ |
| | | delta[i] *= gradient(x[i], a); |
| | | } |
| | | } |
| | | } |
| | | |