lib/torch/optim/adagrad.rb in torch-rb-0.4.2 vs lib/torch/optim/adagrad.rb in torch-rb-0.5.0
- old
+ new
@@ -55,12 +55,12 @@
clr = group[:lr] / (1 + (state[:step] - 1) * group[:lr_decay])
if grad.sparse?
raise NotImplementedYet
else
- state[:sum].addcmul!(1, grad, grad)
+ state[:sum].addcmul!(grad, grad, value: 1)
std = state[:sum].sqrt.add!(group[:eps])
- p.data.addcdiv!(-clr, grad, std)
+ p.data.addcdiv!(grad, std, value: -clr)
end
end
end
loss