diff options
Diffstat (limited to 'contrib/lua-torch/nn/Maxout.lua')
-rw-r--r-- | contrib/lua-torch/nn/Maxout.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/lua-torch/nn/Maxout.lua b/contrib/lua-torch/nn/Maxout.lua new file mode 100644 index 000000000..a797a9f43 --- /dev/null +++ b/contrib/lua-torch/nn/Maxout.lua @@ -0,0 +1,13 @@ +-- Reference: http://jmlr.org/proceedings/papers/v28/goodfellow13.pdf + +local Maxout, parent = torch.class('nn.Maxout', 'nn.Sequential') + +function Maxout:__init(inputSize, outputSize, maxoutNumber, preprocess) + parent.__init(self) + self:add(nn.Linear(inputSize, outputSize * maxoutNumber)) + self:add(nn.View(maxoutNumber, outputSize):setNumInputDims(1)) + if preprocess then + self:add(preprocess) + end + self:add(nn.Max(1, 2)) +end |