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 _initialize(self, name, domain):
      assert isinstance(name, str)
      assert isinstance(domain, RealsType)
      if get_backend() == "torch":
          import torch
  
          return Tensor(torch.randn(domain.shape, requires_grad=True))
      raise NotImplementedError(f"Unsupported backend {get_backend()}")
  
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 3 for calling the Adam obj's underlying member method code with example usage: obj._initialize(name, domain) and returns: Tensor