diff options
author | Jonathan Tompson <tompson@cims.nyu.edu> | 2014-07-22 00:56:33 +0400 |
---|---|---|
committer | Jonathan Tompson <tompson@cims.nyu.edu> | 2014-07-22 01:32:31 +0400 |
commit | 4642c4e4fab849f1dab8d62a6355a9700f745729 (patch) | |
tree | 5568cdd9f083a3d57631be0f23a81fa877b0d5f6 /test | |
parent | ac62b4e2bdec27900a7d70f141e821a77d25a846 (diff) |
wrote a c version of DistKLDivCriterion and added documenation for it.
added >0 check in gradInput as well.
Diffstat (limited to 'test')
-rw-r--r-- | test/test.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua index 55fe7b6..8a15b3e 100644 --- a/test/test.lua +++ b/test/test.lua @@ -498,6 +498,15 @@ function nntest.BCECriterion() criterionJacobianTest1D(cri, input, target) end +function nntest.DistKLDivCriterion() + local input = torch.rand(100) + local target = input:clone():add(torch.rand(100)) + local cri = nn.DistKLDivCriterion(true) -- sizeAverage = true + criterionJacobianTest1D(cri, input, target) + cri = nn.DistKLDivCriterion(false) -- sizeAverage = false + criterionJacobianTest1D(cri, input, target) +end + function nntest.LogSigmoid() local ini = math.random(10,20) local inj = math.random(10,20) |