code: def __init__(self, params, lr=0.05, momentum=0.0, eps=1e-6):
      if lr <= 0.0:
          raise ValueError("Invalid learning rate: {}".format(lr))
      if momentum < 0.0:
          raise ValueError(
              "Invalid momentum value: {}".format(momentum)
          )
      if eps <= 0.0:
          raise ValueError("Invalid epsilon value: {}".format(eps))
  
      defaults = dict(lr=lr, momentum=momentum, eps=eps)
      super(IndexedAdagradM, self).__init__(params, defaults)
  
      for group in self.param_groups:
          for p in group["params"]:
              state = self.state[p]
              state["acc"] = torch.full_like(
                  p, 0, memory_format=torch.preserve_format
              )
              if momentum > 0:
                  state["mom"] = torch.full_like(
                      p, 0, memory_format=torch.preserve_format
                  )
  
imports: from collections import Counter
  import numpy
  import torch
  from torch import nn
  from torch.autograd import Variable
  from torch.optim import Optimizer
  from cornac.utils.common import get_rng
label_desc: Use image node_id 1 to create a new IndexedAdagradM object from inherited base classes: Optimizer with example: obj = IndexedAdagradM(params, lr, momentum, eps)