diff options
author | Aysegul Dundar <adundar@purdue.edu> | 2014-11-30 02:18:21 +0300 |
---|---|---|
committer | Aysegul Dundar <adundar@purdue.edu> | 2014-11-30 02:18:21 +0300 |
commit | 03d6692515d0b1b4752b3eb235b2e7409b878db3 (patch) | |
tree | d114cc671411797643ff78292007e35a1890ca93 /sgd.lua | |
parent | 7553014c6847887553f581548f6ed1dc990ca375 (diff) |
copy variables into state params for type casting
Diffstat (limited to 'sgd.lua')
-rw-r--r-- | sgd.lua | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) |