diff options
author | Clement Farabet <clement.farabet@gmail.com> | 2012-04-02 08:21:10 +0400 |
---|---|---|
committer | Clement Farabet <clement.farabet@gmail.com> | 2012-04-02 08:21:10 +0400 |
commit | de5dc53c9339ad77aee8581904e69ee879a8fe3e (patch) | |
tree | 030b0f76a590782d423ffc56a041c21e292d4849 /test | |
parent | 29cfb869afa0c3fe5545d92a1b978ddb754b2625 (diff) |
Added Divisive Normalization module.
Diffstat (limited to 'test')
-rw-r--r-- | test/test.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua index d67165f..31a6049 100644 --- a/test/test.lua +++ b/test/test.lua @@ -556,6 +556,38 @@ function nntest.SpatialSubtractiveNormalization_1dkernel() mytester:asserteq(berr, 0, torch.typename(module) .. ' - i/o backward err ') end +function nntest.SpatialDivisiveNormalization_2dkernel() + local inputSize = math.random(11,20) + local kersize = 9 + local nbfeatures = math.random(5,10) + local kernel = torch.Tensor(kersize,kersize):fill(1) + local module = nn.SpatialDivisiveNormalization(nbfeatures,kernel) + local input = torch.rand(nbfeatures,inputSize,inputSize) + + local err = jac.testJacobian(module,input) + mytester:assertlt(err,precision, 'error on state ') + + local ferr,berr = jac.testIO(module,input) + mytester:asserteq(ferr, 0, torch.typename(module) .. ' - i/o forward err ') + mytester:asserteq(berr, 0, torch.typename(module) .. ' - i/o backward err ') +end + +function nntest.SpatialDivisiveNormalization_1dkernel() + local inputSize = math.random(11,20) + local kersize = 9 + local nbfeatures = math.random(5,10) + local kernel = torch.Tensor(kersize):fill(1) + local module = nn.SpatialDivisiveNormalization(nbfeatures,kernel) + local input = torch.rand(nbfeatures,inputSize,inputSize) + + local err = jac.testJacobian(module,input) + mytester:assertlt(err,precision, 'error on state ') + + local ferr,berr = jac.testIO(module,input) + mytester:asserteq(ferr, 0, torch.typename(module) .. ' - i/o forward err ') + mytester:asserteq(berr, 0, torch.typename(module) .. ' - i/o backward err ') +end + function nntest.SpatialConvolution() local from = math.random(1,10) local to = math.random(1,10) |