Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/optim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Farabet <clement.farabet@gmail.com>2011-11-03 20:07:50 +0400
committerClement Farabet <clement.farabet@gmail.com>2011-11-03 20:07:50 +0400
commitc50fb86972e8de08c97f0e95be86da4c27504710 (patch)
treeb96dcc9d9c3e5cab96b5428fe134bb6948a3c4d0 /sgd.lua
parentbaba10e54fdfd7c18d69366113db52ddc5158baa (diff)
Fixed eval counter for SGFixed eval counter for SGDD
Diffstat (limited to 'sgd.lua')
-rw-r--r--sgd.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/sgd.lua b/sgd.lua
index d56b8d1..280f8fb 100644
--- a/sgd.lua
+++ b/sgd.lua
@@ -21,7 +21,6 @@ function optim.sgd(opfunc, x, state)
local mom = state.momentum or 0
local lrs = state.learningRates
state.evalCounter = state.evalCounter or 0
- state.evalCounter = state.evalCounter + 1
local nevals = state.evalCounters
-- (1) evaluate f(x) and df/dx
@@ -56,6 +55,9 @@ function optim.sgd(opfunc, x, state)
x:add(-clr, state.dfdx)
end
+ -- (5) update evaluation counter
+ state.evalCounter = state.evalCounter + 1
+
-- return f(x_old), and x_new
return x,fx
end