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
diff options
context:
space:
mode:
authorgermank <german.kruszewski@unitn.it>2014-12-10 13:43:45 +0300
committergermank <german.kruszewski@unitn.it>2014-12-16 15:19:03 +0300
commitd285340cba0d55be08b23a768a1c693dd6e5f4fe (patch)
tree83c062506541f1628547ba055e6418c522e6b07b /test.lua
parentd1584c714469a46c70856c041734f781fcb454b9 (diff)
adding batch processing to CMul
Changed CMul reset of weights to random initialization
Diffstat (limited to 'test.lua')
-rw-r--r--test.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/test.lua b/test.lua
index 89ff7d5..a3c1c85 100644
--- a/test.lua
+++ b/test.lua
@@ -76,6 +76,7 @@ function nntest.CMul()
local input = torch.Tensor(ini,inj,ink):zero()
local module = nn.CMul(ini*inj*ink)
+ -- 1D
local err = jac.testJacobian(module,input)
mytester:assertlt(err,precision, 'error on state ')
@@ -90,6 +91,26 @@ function nntest.CMul()
'error on weight [%s]', t))
end
+ -- 2D
+ local nframe = math.random(50,70)
+ local nframe = 5
+ local input = torch.Tensor(nframe, ini,inj,ink):zero()
+
+ local err = jac.testJacobian(module,input)
+ mytester:assertlt(err,precision, 'error on state ')
+
+ local err = jac.testJacobianParameters(module, input, module.weight, module.gradWeight)
+ mytester:assertlt(err,precision, 'error on weight ')
+
+ local err = jac.testJacobianUpdateParameters(module, input, module.weight)
+ mytester:assertlt(err,precision, 'error on weight [direct update] ')
+
+ for t,err in pairs(jac.testAllUpdate(module, input, 'weight', 'gradWeight')) do
+ mytester:assertlt(err, precision, string.format('error on weight [%s]', t))
+ end
+
+
+ -- IO
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 ')