class_docstr: Stochastic gradient descent with momentum.
  
  Given the parameters :math:`\theta`, the learning rate :math:`\alpha`,
  and the gradients :math:`\nabla J(\theta; x)`
  computed on the minibatch data :math:`x`, SGD updates the parameters via
  
  .. math::
      \theta' = \theta - \alpha\nabla J(\theta; x)
  
  Here we implement SGD with momentum. Momentum tracks the history of
  gradient updates to help the system move faster through saddle points.
  Given the additional parameters: momentum :math:`\gamma`, weight decay :math:`\lambda`,
  and current velocity :math:`v`, we use the following update equations
  
  .. math::
      v' = \gamma v - \alpha(\nabla J(\theta; x) + \lambda\theta)
      theta' = \theta + v'
  
  The optional `nesterov` parameter implements Nesterov Accelerated Gradient.
  If this is set, we use the following update equations instead
  .. math::
      v' = \gamma^2 v + \alpha (\gamma + 1) (\nabla J(\theta; x) + \lambda\theta)
      theta' = \theta + v'
  
  Example usage:
  
  .. code-block:: python
  
      from neon.optimizers import GradientDescentMomentum
  
      # use SGD with learning rate 0.01 and momentum 0.9, while
      # clipping the gradient magnitude to between -5 and 5.
      opt = GradientDescentMomentum(0.01, 0.9, gradient_clip_value = 5)
class_docstr_tok: ["Stochastic","gradient","descent","with","momentum",".","Given","the","parameters",":","math",":","`","\\theta","`",",","the","learning","rate",":","math",":","`","\\alpha","`",",","and","the","gradients",":","math",":","`","\\nabla","J","(","\\theta",";","x",")","`","computed","on","the","minibatch","data",":","math",":","`","x","`",",","SGD","updates","the","parameters","via","..","math",":",":","\\theta","'","=","\\theta","-","\\alpha\\nabla","J","(","\\theta",";","x",")","Here","we","implement","SGD","with","momentum",".","Momentum","tracks","the","history","of","gradient","updates","to","help","the","system","move","faster","through","saddle","points",".","Given","the","additional","parameters",":","momentum",":","math",":","`","\\gamma","`",",","weight","decay",":","math",":","`","\\lambda","`",",","and","current","velocity",":","math",":","`","v","`",",","we","use","the","following","update","equations","..","math",":",":","v","'","=","\\gamma","v","-","\\alpha","(","\\nabla","J","(","\\theta",";","x",")","+","\\lambda\\theta",")","theta","'","=","\\theta","+","v'","The","optional","`","nesterov","`","parameter","implements","Nesterov","Accelerated","Gradient",".","If","this","is","set",",","we","use","the","following","update","equations","instead","..","math",":",":","v","'","=","\\gamma^2","v","+","\\alpha","(","\\gamma","+","1",")","(","\\nabla","J","(","\\theta",";","x",")","+","\\lambda\\theta",")","theta","'","=","\\theta","+","v'","Example","usage",":","..","code-block",":",":","python","from","neon.optimizers","import","GradientDescentMomentum","#","use","SGD","with","learning","rate","0.01","and","momentum","0.9",",","while","#","clipping","the","gradient","magnitude","to","between","-5","and","5.","opt","=","GradientDescentMomentum","(","0.01",",","0.9",",","gradient_clip_value","=","5",")"]
docstr: Class constructor.
  
  Arguments:
      learning_rate (float): Multiplicative coefficient of updates
      momentum_coef (float): Coefficient of momentum
      stochastic_round (bool, optional): Set this to True for stochastic
                                         rounding.  If False (default)
                                         rounding will be to nearest.  If
                                         True use default width
                                         stochastic rounding.  Note that
                                         this only affects the GPU
                                         backend.
      wdecay (float, optional): Amount of weight decay.  Defaults to 0
      gradient_clip_norm (float, optional): Target gradient norm.
                                            Defaults to None.
      gradient_clip_value (float, optional): Value to element-wise clip
                                             gradients.
                                             Defaults to None.
      param_clip_value (float, optional): Value to element-wise clip
                                          parameters.
                                          Defaults to None.
      name (str, optional): the optimizer's layer's pretty-print name.
                            Defaults to "gdm".
      schedule (neon.optimizers.optimizer.Schedule, optional): Learning
                  rate schedule.  Defaults to a constant learning rate.
      nesterov (bool, optional): Use nesterov accelerated gradient.
                                 Defaults to False.
docstr_tok: ["Class","constructor",".","Arguments",":","learning_rate","(","float",")",":","Multiplicative","coefficient","of","updates","momentum_coef","(","float",")",":","Coefficient","of","momentum","stochastic_round","(","bool",",","optional",")",":","Set","this","to","True","for","stochastic","rounding",".","If","False","(","default",")","rounding","will","be","to","nearest",".","If","True","use","default","width","stochastic","rounding",".","Note","that","this","only","affects","the","GPU","backend",".","wdecay","(","float",",","optional",")",":","Amount","of","weight","decay",".","Defaults","to","0","gradient_clip_norm","(","float",",","optional",")",":","Target","gradient","norm",".","Defaults","to","None",".","gradient_clip_value","(","float",",","optional",")",":","Value","to","element-wise","clip","gradients",".","Defaults","to","None",".","param_clip_value","(","float",",","optional",")",":","Value","to","element-wise","clip","parameters",".","Defaults","to","None",".","name","(","str",",","optional",")",":","the","optimizer","'s","layer","'s","pretty-print","name",".","Defaults","to","``","gdm","''",".","schedule","(","neon.optimizers.optimizer.Schedule",",","optional",")",":","Learning","rate","schedule",".","Defaults","to","a","constant","learning","rate",".","nesterov","(","bool",",","optional",")",":","Use","nesterov","accelerated","gradient",".","Defaults","to","False","."]
code: def __init__(
      self,
      learning_rate,
      momentum_coef,
      stochastic_round=False,
      wdecay=0.0,
      gradient_clip_norm=None,
      gradient_clip_value=None,
      param_clip_value=None,
      name=None,
      schedule=Schedule(),
      nesterov=False,
  ):
      """
      Class constructor.
  
      Arguments:
          learning_rate (float): Multiplicative coefficient of updates
          momentum_coef (float): Coefficient of momentum
          stochastic_round (bool, optional): Set this to True for stochastic
                                             rounding.  If False (default)
                                             rounding will be to nearest.  If
                                             True use default width
                                             stochastic rounding.  Note that
                                             this only affects the GPU
                                             backend.
          wdecay (float, optional): Amount of weight decay.  Defaults to 0
          gradient_clip_norm (float, optional): Target gradient norm.
                                                Defaults to None.
          gradient_clip_value (float, optional): Value to element-wise clip
                                                 gradients.
                                                 Defaults to None.
          param_clip_value (float, optional): Value to element-wise clip
                                              parameters.
                                              Defaults to None.
          name (str, optional): the optimizer's layer's pretty-print name.
                                Defaults to "gdm".
          schedule (neon.optimizers.optimizer.Schedule, optional): Learning
                      rate schedule.  Defaults to a constant learning rate.
          nesterov (bool, optional): Use nesterov accelerated gradient.
                                     Defaults to False.
      """
      super(GradientDescentMomentum, self).__init__(name=name)
      self.learning_rate, self.momentum_coef = (
          learning_rate,
          momentum_coef,
      )
      self.gradient_clip_norm = gradient_clip_norm
      self.gradient_clip_value = gradient_clip_value
      self.param_clip_value = param_clip_value
      self.wdecay = wdecay
      self.schedule = schedule
      self.stochastic_round = stochastic_round
      self.nesterov = nesterov
      if self.momentum_coef == 0 and self.nesterov:
          raise ValueError("nesterov requires non-zero momentum")
  
imports: from __future__ import division
  from neon import NervanaObject
  from neon.util.persist import load_class
  import logging
  import numpy
label_desc: Use image node_id 1 to create a new GradientDescentMomentum object from inherited base classes: Optimizer with example: obj = GradientDescentMomentum(learning_rate, momentum_coef, stochastic_round, wdecay, gradient_clip_norm, gradient_clip_value, param_clip_value, name, schedule, nesterov)