From ee25ad42c5e9ecdc5a3aa7125e657ce26cc9535c Mon Sep 17 00:00:00 2001
From: Edmond Yoo <hj3yoo@uwaterloo.ca>
Date: Sun, 16 Sep 2018 02:48:50 +0000
Subject: [PATCH] temp
---
src/activations.c | 28 +++++++++++++++++++++++++---
1 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/activations.c b/src/activations.c
index 6b98e1c..eab4e23 100644
--- a/src/activations.c
+++ b/src/activations.c
@@ -30,6 +30,10 @@
return "leaky";
case STAIR:
return "stair";
+ case HARDTAN:
+ return "hardtan";
+ case LHTAN:
+ return "lhtan";
default:
break;
}
@@ -44,6 +48,8 @@
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;
@@ -78,6 +84,10 @@
return plse_activate(x);
case STAIR:
return stair_activate(x);
+ case HARDTAN:
+ return hardtan_activate(x);
+ case LHTAN:
+ return lhtan_activate(x);
}
return 0;
}
@@ -85,8 +95,16 @@
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);
+ }
}
}
@@ -115,6 +133,10 @@
return plse_gradient(x);
case STAIR:
return stair_gradient(x);
+ case HARDTAN:
+ return hardtan_gradient(x);
+ case LHTAN:
+ return lhtan_gradient(x);
}
return 0;
}
@@ -125,5 +147,5 @@
for(i = 0; i < n; ++i){
delta[i] *= gradient(x[i], a);
}
-}
+}
--
Gitblit v1.10.0