Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/nn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Cavigelli <cavigelli@iis.ee.ethz.ch>2015-11-29 16:26:25 +0300
committerLukas Cavigelli <cavigelli@iis.ee.ethz.ch>2015-11-29 16:35:42 +0300
commitfd0d616f8081d571e5e97252f5de55f704fda1d8 (patch)
tree2d7724ce791c68d8e08ebee3fda8345d87bccccb /ELU.lua
parent67539096613c3c0174600936523e2624ad803966 (diff)
added ELU unit incl documentation
Diffstat (limited to 'ELU.lua')
-rw-r--r--ELU.lua29
1 files changed, 26 insertions, 3 deletions
diff --git a/ELU.lua b/ELU.lua
index a6eb271..f3f7dd1 100644
--- a/ELU.lua
+++ b/ELU.lua
@@ -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