diff options
author | Clement Farabet <clement.farabet@gmail.com> | 2012-09-14 18:23:47 +0400 |
---|---|---|
committer | Clement Farabet <clement.farabet@gmail.com> | 2012-09-14 18:23:47 +0400 |
commit | c4ec7d3e275074df635b78e2c1558931c5931919 (patch) | |
tree | eb7502914954fd1638abda12243712d13bf9ed87 | |
parent | 2f1b5b074ef88c70c2ebb9b4aeddd5554c029452 (diff) | |
parent | e412a7721efc3e4f4a85a0fb3a73794ef27de236 (diff) |
Merge branch 'master' of github.com:andresy/torch
-rw-r--r-- | Jacobian.lua | 2 | ||||
-rw-r--r-- | generic/Square.c | 2 | ||||
-rw-r--r-- | test/test.lua | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Jacobian.lua b/Jacobian.lua index a46cd43..16397a9 100644 --- a/Jacobian.lua +++ b/Jacobian.lua @@ -168,7 +168,7 @@ function nn.Jacobian.testIO(module,input, minval, maxval) -- read module local m = torch.DiskFile('tmp.bin'):binary():readObject() m:forward(input) - module:zeroGradParameters() + m:zeroGradParameters() m:updateGradInput(input,go) m:accGradParameters(input,go) -- cleanup diff --git a/generic/Square.c b/generic/Square.c index 33feaa9..4e20116 100644 --- a/generic/Square.c +++ b/generic/Square.c @@ -40,7 +40,7 @@ static int nn_(Square_updateGradInput)(lua_State *L) !THTensor_(isContiguous)(gradInput)) { TH_TENSOR_APPLY3(real, gradInput, real, gradOutput, real, input, \ - *gradInput_data = (*gradOutput_data) * (*input_data);); + *gradInput_data = 2.0 * (*gradOutput_data) * (*input_data);); } else { diff --git a/test/test.lua b/test/test.lua index ff8b0d9..0d4a979 100644 --- a/test/test.lua +++ b/test/test.lua @@ -82,10 +82,10 @@ function nntest.Log() local input = torch.Tensor(ini,inj,ink):zero() local module = nn.Log() - local err = jac.testJacobian(module,input) + local err = jac.testJacobian(module,input, 0.1, 10) mytester:assertlt(err,precision, 'error on state ') - local ferr,berr = jac.testIO(module,input) + local ferr,berr = jac.testIO(module,input, 0.1, 10) mytester:asserteq(ferr, 0, torch.typename(module) .. ' - i/o forward err ') mytester:asserteq(berr, 0, torch.typename(module) .. ' - i/o backward err ') end |