diff options
Diffstat (limited to 'test/test-all.lua')
-rw-r--r-- | test/test-all.lua | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/test/test-all.lua b/test/test-all.lua index 148e860..f7e591a 100644 --- a/test/test-all.lua +++ b/test/test-all.lua @@ -301,93 +301,6 @@ function nnxtest.SpatialConvolution() mytester:asserteq(berr, 0, torch.typename(module) .. ' - i/o backward err ') end -function nnxtest.SpatialConvolutionSparse_1() - local from = math.random(1,10) - local to = math.random(1,10) - local ini = math.random(10,20) - local inj = math.random(10,20) - local ki = math.random(1,10) - local kj = math.random(1,10) - local si = math.random(1,1) - local sj = math.random(1,1) - - local ct = nn.tables.full(from,to) - local module = nn.SpatialConvolutionSparse(ct, ki, kj, si, sj) - local input = torch.Tensor(from, inj, ini):zero() - module:reset() - - local err = nn.Jacobian.testJacobian(module, input) - mytester:assertlt(err, precision, 'error on state ') - - local err = nn.Jacobian.testJacobianParameters(module, input, module.weight, module.gradWeight) - mytester:assertlt(err, precision, 'error on weight ') - - local err = nn.Jacobian.testJacobianParameters(module, input, module.bias, module.gradBias) - mytester:assertlt(err, precision, 'error on bias ') - - local ferr, berr = nn.Jacobian.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 nnxtest.SpatialConvolutionSparse_2() - local from = math.random(1,10) - local to = math.random(1,10) - local ini = math.random(10,20) - local inj = math.random(10,20) - local ki = math.random(1,10) - local kj = math.random(1,10) - local si = math.random(1,1) - local sj = math.random(1,1) - - local ct = nn.tables.oneToOne(from) - local module = nn.SpatialConvolutionSparse(ct, ki, kj, si, sj) - local input = torch.Tensor(from, inj, ini):zero() - module:reset() - - local err = nn.Jacobian.testJacobian(module, input) - mytester:assertlt(err, precision, 'error on state ') - - local err = nn.Jacobian.testJacobianParameters(module, input, module.weight, module.gradWeight) - mytester:assertlt(err, precision, 'error on weight ') - - local err = nn.Jacobian.testJacobianParameters(module, input, module.bias, module.gradBias) - mytester:assertlt(err, precision, 'error on bias ') - - local ferr, berr = nn.Jacobian.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 nnxtest.SpatialConvolutionSparse_3() - local from = math.random(2,6) - local to = math.random(4,8) - local ini = math.random(10,20) - local inj = math.random(10,20) - local ki = math.random(1,10) - local kj = math.random(1,10) - local si = math.random(1,1) - local sj = math.random(1,1) - - local ct = nn.tables.random(from,to,from-1) - local module = nn.SpatialConvolutionSparse(ct, ki, kj, si, sj) - local input = torch.Tensor(from, inj, ini):zero() - module:reset() - - local err = nn.Jacobian.testJacobian(module, input) - mytester:assertlt(err, precision, 'error on state ') - - local err = nn.Jacobian.testJacobianParameters(module, input, module.weight, module.gradWeight) - mytester:assertlt(err, precision, 'error on weight ') - - local err = nn.Jacobian.testJacobianParameters(module, input, module.bias, module.gradBias) - mytester:assertlt(err, precision, 'error on bias ') - - local ferr, berr = nn.Jacobian.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 nnxtest.SpatialNormalization_Gaussian2D() local inputSize = math.random(11,20) local kersize = 9 |