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
path: root/test
diff options
context:
space:
mode:
authornicholas-leonard <nick@nikopia.org>2014-07-09 22:42:39 +0400
committernicholas-leonard <nick@nikopia.org>2014-07-09 22:42:39 +0400
commit12355083c7d11328bdb1b610c76c936eaa6ed293 (patch)
treeb9a3e72a276803f02d06d2b235fef66b0438a23b /test
parentb7822796d2d02815076b3e10b0b32fcc3c133242 (diff)
Dropout unit tests
Diffstat (limited to 'test')
-rw-r--r--test/test.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua
index c88c908..8b4cfb9 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -60,6 +60,16 @@ function nntest.CMul()
mytester:asserteq(berr, 0, torch.typename(module) .. ' - i/o backward err ')
end
+function nntest.Dropout()
+ local p = 0.2 --prob of droping out a neuron
+ local input = torch.Tensor(1000):fill(1)
+ local module = nn.Dropout(p)
+ local output = module:forward(input)
+ mytester:assert(math.abs(output:mean() - (1-p)) < 0.05, 'dropout output')
+ local gradInput = module:backward(input, input)
+ mytester:assert(math.abs(gradInput:mean() - (1-p)) < 0.05, 'dropout gradInput')
+end
+
function nntest.Exp()
local ini = math.random(10,20)
local inj = math.random(10,20)