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:
authorAysegul Dundar <adundar@purdue.edu>2014-11-30 02:18:21 +0300
committerAysegul Dundar <adundar@purdue.edu>2014-11-30 02:18:21 +0300
commit03d6692515d0b1b4752b3eb235b2e7409b878db3 (patch)
treed114cc671411797643ff78292007e35a1890ca93 /sgd.lua
parent7553014c6847887553f581548f6ed1dc990ca375 (diff)
copy variables into state params for type casting
Diffstat (limited to 'sgd.lua')
-rw-r--r--sgd.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/sgd.lua b/sgd.lua
index e362d6c..8ad59e4 100644
--- a/sgd.lua
+++ b/sgd.lua
@@ -49,7 +49,7 @@ function optim.sgd(opfunc, x, config, state)
if not state.decayParameters then
state.decayParameters = torch.Tensor():typeAs(x):resizeAs(dfdx)
end
- state.decayParameters:cmul(wds, x)
+ state.decayParameters:copy(wds):cmul(x)
dfdx:add(state.decayParameters)
end
@@ -75,7 +75,7 @@ function optim.sgd(opfunc, x, config, state)
if not state.deltaParameters then
state.deltaParameters = torch.Tensor():typeAs(x):resizeAs(dfdx)
end
- state.deltaParameters:cmul(lrs, dfdx)
+ state.deltaParameters:copy(lrs):cmul(dfdx)
x:add(-clr, state.deltaParameters)
else
x:add(-clr, dfdx)