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:
authorGeorgOstrovski <ostrovski@google.com>2014-07-10 21:35:51 +0400
committerGeorgOstrovski <ostrovski@google.com>2014-07-10 21:35:51 +0400
commit66482a0dab2d3da6fe5ef66c6990ac136c2cf001 (patch)
tree6a7b7c93f2f7bc41e06cb10364a36a84b7c9a7af /test
parent7d4971d39e2cf8e7f7069260ad57da298e008a2a (diff)
Corrected BCECriterion test
Changed test so that a) both input and target have entries lying between 0 and 1 b) both input and target have entries at least 0.01 away from 0 / 1. This is needed to make this test stable - it otherwise fails frequently depending on random initialisation (the numerical approximation of the gradient of log(x) and log(1-x) diverges from the actual values near x=0 and x=1)
Diffstat (limited to 'test')
-rw-r--r--test/test.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/test.lua b/test/test.lua
index 135624d..a5550b7 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -477,8 +477,9 @@ function nntest.WeightedMSECriterion()
end
function nntest.BCECriterion()
- local input = torch.rand(100)
- local target = input:clone():add(torch.rand(100))
+ local eps = 1e-2
+ local input = torch.rand(100)*(1-eps) + eps/2
+ local target = torch.rand(100)*(1-eps) + eps/2
local cri = nn.BCECriterion()
criterionJacobianTest1D(cri, input, target)
end