class_docstr: Usage::
      with Adam(num_steps=100, lr=0.05)) as optim:
          x = loss.reduce(ops.min)
  
      print("final loss", x)  # equivalent to loss(**optim.params)
      for name in loss.inputs:
          print(name, optim.params(name))
class_docstr_tok: ["Usage",":",":","with","Adam","(","num_steps=100",",","lr=0.05",")",")","as","optim",":","x","=","loss.reduce","(","ops.min",")","print","(","``","final","loss","''",",","x",")","#","equivalent","to","loss","(","*","*","optim.params",")","for","name","in","loss.inputs",":","print","(","name",",","optim.params","(","name",")",")"]
code: def __init__(self, num_steps, **kwargs):
      name = kwargs.pop("name", "adam")
      super().__init__(name)
      self.num_steps = num_steps
      self.log_every = kwargs.pop("log_every", 0)
      self.optim_params = kwargs  # TODO make precise
      self.params = kwargs.pop("params", {})
  
file_path: funsor/funsor/adam.py
imports: import funsor.ops
  from funsor.domains import RealsType
  from funsor.interpretations import StatefulInterpretation
  from funsor.tensor import Tensor
  from funsor.terms import Funsor, Reduce
  from funsor.util import get_backend
label_desc: Use image node_id 1 to create a new Adam object from inherited base classes: StatefulInterpretation with example: obj = Adam(num_steps)