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:
authorPáidí Creed <paidi@swiftkey.net>2013-11-06 19:15:28 +0400
committerPáidí Creed <paidi@swiftkey.net>2013-11-06 19:15:28 +0400
commitaa60b6e2be23beb899b3eca28c762793afea52a6 (patch)
tree17584525dd35143c4aec254269da571ff1def87b /test
parentd1c7da6a9f760c31a1b27477e27b124e84d556ab (diff)
parentb8f17d4136410b80bf621ff660abb8ab1ed7bf5e (diff)
Merge remote-tracking branch 'upstream/master'
Conflicts: extra/nn/test/test.lua
Diffstat (limited to 'test')
-rw-r--r--test/test.lua43
1 files changed, 34 insertions, 9 deletions
diff --git a/test/test.lua b/test/test.lua
index 0147ea3..89db059 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -387,21 +387,20 @@ function nntest.WeightedEuclidean()
mytester:asserteq(berr, 0, torch.typename(module) .. ' - i/o backward err ')
end
--- function nntest.WeightedMSECriterion()
+--function nntest.WeightedMSECriterion()
-- local from = math.random(100,200)
-- local input = torch.Tensor(from):zero()
-- local target = torch.randn(from)
-- local weight = torch.randn(from)
-- local cri = nn.WeightedMSECriterion(weight)
-- local module = nn.CriterionModule(cri,target)
-
--- local err = jac.testJacobian(module, input)
+-- local err = jac.testJacobian(module, input)
-- mytester:assertlt(err, precision, 'error on state ')
--- local ferr, berr = jac.testIO(module, input)
+-- local ferr, berr = jac.testIO(module, input)
-- mytester:asserteq(0, ferr, torch.typename(module) .. ' - i/o forward err ')
-- mytester:asserteq(0, berr, torch.typename(module) .. ' - i/o backward err ')
--- end
+--end
function nntest.LogSigmoid()
local ini = math.random(10,20)
@@ -1347,10 +1346,10 @@ function nntest.TemporalSubSampling()
end
function nntest.TemporalMaxPooling()
- local from = math.random(1,10)
- local ki = math.random(1,10)
- local si = math.random(1,4)
- local outi = math.random(10,20)
+ local from = math.random(10,10)
+ local ki = math.random(5,10)
+ local si = math.random(1,2)
+ local outi = math.random(50,90)
local ini = (outi-1)*si+ki
local module = nn.TemporalMaxPooling(ki, si)
local input = torch.Tensor(ini, from):zero()
@@ -1411,6 +1410,32 @@ function nntest.VolumetricConvolution()
mytester:asserteq(0, berr, torch.typename(module) .. ' - i/o backward err ')
end
+function nntest.VolumetricMaxPooling()
+ local from = math.random(2,5)
+ local to = from
+ local kt = math.random(3,7)
+ local ki = math.random(3,7)
+ local kj = math.random(3,7)
+ local st = math.random(2,4)
+ local si = math.random(2,4)
+ local sj = math.random(2,4)
+ local outt = math.random(3,7)
+ local outi = math.random(3,7)
+ local outj = math.random(3,7)
+ local int = (outt-1)*st+kt
+ local ini = (outi-1)*si+ki
+ local inj = (outj-1)*sj+kj
+ local module = nn.VolumetricMaxPooling(kt, ki, kj, st, si, sj)
+ local input = torch.Tensor(from, int, inj, ini):zero()
+
+ local err = jac.testJacobian(module, input)
+ mytester:assertlt(err, precision, 'error on state ')
+
+ local ferr, berr = jac.testIO(module, input)
+ mytester:asserteq(0, ferr, torch.typename(module) .. ' - i/o forward err ')
+ mytester:asserteq(0, berr, torch.typename(module) .. ' - i/o backward err ')
+end
+
function nntest.Module_getParameters_1()
local n = nn.Sequential()
n:add( nn.Linear(10,10) )