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:
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)