aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-11-23 15:44:30 +0800
committerDeterminant <[email protected]>2015-11-23 15:44:30 +0800
commit591e04a088b31b8c506f885ed3e54203cdfd11b6 (patch)
tree53a5e75ff83c7a357f26f93fb2741ceeb5f16254
parent52dc38775347efb7bf56210b4c3f5935d19317cd (diff)
correct the use of self.gconf
-rw-r--r--nerv/layer/affine.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/nerv/layer/affine.lua b/nerv/layer/affine.lua
index 02a3536..6903c51 100644
--- a/nerv/layer/affine.lua
+++ b/nerv/layer/affine.lua
@@ -21,7 +21,7 @@ function MatrixParam:_update_by_gradient(gradient, alpha, beta)
local gconf = self.gconf
-- momentum gain
local mmt_gain = 1.0 / (1.0 - gconf.momentum)
- local n = self.gconf.batch_size * mmt_gain
+ local n = gconf.batch_size * mmt_gain
-- perform update
if gconf.momentum > 0 then
self.correction:add(self.correction, gradient, gconf.momentum, 1.0)
@@ -35,7 +35,7 @@ function MatrixParam:_update_by_err_input(err, input, alpha, beta)
local gconf = self.gconf
-- momentum gain
local mmt_gain = 1.0 / (1.0 - gconf.momentum)
- local n = self.gconf.batch_size * mmt_gain
+ local n = gconf.batch_size * mmt_gain
-- perform update
if gconf.momentum > 0 then
self.correction:mul(input, err, 1.0, gconf.momentum, 'T', 'N')
@@ -54,6 +54,7 @@ function MatrixParam:update_by_err_input(err, input)
end
function LinearTransParam:update_by_err_input(err, input)
+ local gconf = self.gconf
local l2 = 1 - gconf.lrate * gconf.wcost
self:_update_by_err_input(err, input, l2, l2)
end