class_docstr: Momentum optimizer.
docstr: Constructor for momentum optimizer class.
  
  Args:
      vc: collection of variables to optimize.
      momentum: the momentum hyperparameter.
      nesterov: bool indicating whether to use the Nesterov method.
docstr_tok: ["Constructor","for","momentum","optimizer","class",".","Args",":","vc",":","collection","of","variables","to","optimize",".","momentum",":","the","momentum","hyperparameter",".","nesterov",":","bool","indicating","whether","to","use","the","Nesterov","method","."]
code: def __init__(
      self,
      vc: VarCollection,
      momentum: float = 0.9,
      nesterov: bool = False,
  ):
      """Constructor for momentum optimizer class.
  
      Args:
          vc: collection of variables to optimize.
          momentum: the momentum hyperparameter.
          nesterov: bool indicating whether to use the Nesterov method.
      """
      self.momentum = momentum
      self.nesterov = nesterov
      self.train_vars = ModuleList(
          TrainRef(x) for x in vc.subset(TrainVar)
      )
      self.m = ModuleList(
          StateVar(jn.zeros_like(x.value)) for x in self.train_vars
      )
  
file_path: objax/objax/optimizer/momentum.py
imports: from typing import List, Optional
  from jax import numpy
  from objax.module import Module, ModuleList
  from objax.util import class_name
  from objax.variable import TrainRef, StateVar, TrainVar, VarCollection
label_desc: Use image node_id 1 to create a new Momentum object from inherited base classes: Module with example: obj = Momentum(vc, momentum, nesterov)