diff options
author | Ronan Collobert <ronan@collobert.com> | 2014-11-18 02:30:27 +0300 |
---|---|---|
committer | Ronan Collobert <ronan@collobert.com> | 2014-11-18 02:30:27 +0300 |
commit | 564d37223f837f5eff15d1973c06b3c837ce50d5 (patch) | |
tree | 83b13c9043ba9314acf8e3034e24a477a4dfcd50 /test | |
parent | bc684d87cdaecae4b2e7f88006f5033cac32867c (diff) |
fix 1D case for Mean/Sum/Max/Min
Diffstat (limited to 'test')
-rw-r--r-- | test/test.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua index 9f7b225..cdbf399 100644 --- a/test/test.lua +++ b/test/test.lua @@ -595,6 +595,15 @@ end -- end function nntest.Max() + -- 1D + local ini = math.random(3,7) + local input = torch.Tensor(ini):zero() + local module = nn.Max(1) + + local err = jac.testJacobian(module,input) + mytester:assertlt(err,precision, 'error on state ') + + -- 3D local ini = math.random(3,5) local inj = math.random(3,5) local ink = math.random(3,5) @@ -610,6 +619,15 @@ function nntest.Max() end function nntest.Min() + -- 1D + local ini = math.random(3,7) + local input = torch.Tensor(ini):zero() + local module = nn.Min(1) + + local err = jac.testJacobian(module,input) + mytester:assertlt(err,precision, 'error on state ') + + -- 3D local ini = math.random(3,5) local inj = math.random(3,5) local ink = math.random(3,5) @@ -625,6 +643,15 @@ function nntest.Min() end function nntest.Mean() + -- 1D + local ini = math.random(3,7) + local input = torch.Tensor(ini):zero() + local module = nn.Mean(1) + + local err = jac.testJacobian(module,input) + mytester:assertlt(err,precision, 'error on state ') + + -- 3D local ini = math.random(3,5) local inj = math.random(3,5) local ink = math.random(3,5) @@ -1423,6 +1450,15 @@ function nntest.SpatialLPPooling() end function nntest.Sum() + -- 1D + local ini = math.random(3,7) + local input = torch.Tensor(ini):zero() + local module = nn.Sum(1) + + local err = jac.testJacobian(module,input) + mytester:assertlt(err,precision, 'error on state ') + + -- 3D local ini = math.random(3,5) local inj = math.random(3,5) local ink = math.random(3,5) |