diff options
author | Lukas Cavigelli <cavigelli@iis.ee.ethz.ch> | 2015-11-29 16:26:25 +0300 |
---|---|---|
committer | Lukas Cavigelli <cavigelli@iis.ee.ethz.ch> | 2015-11-29 16:35:42 +0300 |
commit | fd0d616f8081d571e5e97252f5de55f704fda1d8 (patch) | |
tree | 2d7724ce791c68d8e08ebee3fda8345d87bccccb /ELU.lua | |
parent | 67539096613c3c0174600936523e2624ad803966 (diff) |
added ELU unit incl documentation
Diffstat (limited to 'ELU.lua')
-rw-r--r-- | ELU.lua | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -1,5 +1,28 @@ -local ReLU, Parent = torch.class('nn.ReLU', 'nn.Threshold') +local ELU, parent = torch.class('nn.ELU', 'nn.Module') -function ReLU:__init(p) - Parent.__init(self,0,0,p) + +--[[ + Djork-Arné Clevert, Thomas Unterthiner, Sepp Hochreiter + Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs) + http://arxiv.org/pdf/1511.07289.pdf +--]] + +function ELU:__init(alpha) + parent.__init(self) + self.alpha = alpha or 1 + assert(type(self.alpha) == 'number') +end + +function ELU:updateOutput(input) + input.nn.ELU_updateOutput(self, input) + return self.output +end + +function ELU:updateGradInput(input, gradOutput) + input.nn.ELU_updateGradInput(self, input, gradOutput) + return self.gradInput +end + +function ELU:__tostring__() + return string.format('%s (alpha:%f)', torch.type(self), self.alpha) end |