lib/torch/optim/adadelta.rb in torch-rb-0.4.2 vs lib/torch/optim/adadelta.rb in torch-rb-0.5.0
- old
+ new
@@ -40,14 +40,14 @@
if group[:weight_decay] != 0
grad = grad.add(p.data, alpha: group[:weight_decay])
end
- square_avg.mul!(rho).addcmul!(1 - rho, grad, grad)
+ square_avg.mul!(rho).addcmul!(grad, grad, value: 1 - rho)
std = square_avg.add(eps).sqrt!
delta = acc_delta.add(eps).sqrt!.div!(std).mul!(grad)
p.data.add!(delta, alpha: -group[:lr])
- acc_delta.mul!(rho).addcmul!(1 - rho, delta, delta)
+ acc_delta.mul!(rho).addcmul!(delta, delta, value: 1 - rho)
end
end
loss
end