From bac54e14d29e7e88e3f5e9cc0e89a95285e4a4df Mon Sep 17 00:00:00 2001 From: hartbook <franck.dary@etu.univ-amu.fr> Date: Tue, 10 Jul 2018 10:57:12 +0200 Subject: [PATCH] Added support for ELU activation --- MLP/include/MLP.hpp | 1 + MLP/src/MLP.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/MLP/include/MLP.hpp b/MLP/include/MLP.hpp index a7efc5e..efe83ae 100644 --- a/MLP/include/MLP.hpp +++ b/MLP/include/MLP.hpp @@ -19,6 +19,7 @@ class MLP SIGMOID, TANH, RELU, + ELU, LINEAR, SPARSEMAX, CUBE, diff --git a/MLP/src/MLP.cpp b/MLP/src/MLP.cpp index ac2594a..da90235 100644 --- a/MLP/src/MLP.cpp +++ b/MLP/src/MLP.cpp @@ -15,6 +15,9 @@ std::string MLP::activation2str(Activation a) case RELU : return "RELU"; break; + case ELU : + return "ELU"; + break; case CUBE : return "CUBE"; break; @@ -43,6 +46,8 @@ MLP::Activation MLP::str2activation(std::string s) return LINEAR; else if(s == "RELU") return RELU; + else if(s == "ELU") + return ELU; else if(s == "CUBE") return CUBE; else if(s == "SIGMOID") @@ -230,6 +235,9 @@ inline dynet::Expression MLP::activate(dynet::Expression h, Activation f) case RELU : return rectify(h); break; + case ELU : + return elu(h); + break; case SIGMOID : return logistic(h); break; -- GitLab