class Chainer::Optimizers::MomentumSGD

Momentum SGD optimizer

Attributes

lr[RW]
momentum[RW]

Public Class Methods

new(lr: nil, momentum: nil) click to toggle source

@param [Float] lr Learning rate @param [Float] momentum Exponential decay rate of the first order moment

Calls superclass method Chainer::GradientMethod::new
# File lib/chainer/optimizers/momentum_sgd.rb, line 36
def initialize(lr: nil, momentum: nil)
  super()
  @hyperparam.instance_variable_set('@lr', lr || 0.01)
  @hyperparam.instance_variable_set('@momentum', momentum || 0.9)
  Chainer::HyperparameterProxy.new(self, "lr")
  Chainer::HyperparameterProxy.new(self, "momentum")
end

Public Instance Methods

create_update_rule() click to toggle source
# File lib/chainer/optimizers/momentum_sgd.rb, line 44
def create_update_rule
  MomentumSGDRule.new(parent_hyperparam: @hyperparam)
end