code: def _single_tensor_adagrad(
      params: List[Tensor],
      grads: List[Tensor],
      state_sums: List[Tensor],
      state_steps: List[Tensor],
      *,
      lr: float,
      weight_decay: float,
      lr_decay: float,
      eps: float,
      maximize: bool,
  ) -> None:
      for param, grad, state_sum, step_t in zip(
          params, grads, state_sums, state_steps
      ):
          if grad.is_sparse:
              raise RuntimeError(
                  "RowWise adagrad cannot be used with sparse gradients"
              )
          # update step
          step_t += 1
          step = step_t.item()
          grad = grad if not maximize else -grad
  
          row_wise_grad = grad.mean(axis=1).view(-1, 1)
          if weight_decay != 0:
              grad = grad.add(param, alpha=weight_decay)
              row_wise_grad = grad.add(param, alpha=weight_decay)
  
          clr = lr / (1 + (step - 1) * lr_decay)
  
          state_sum.addcmul_(row_wise_grad, row_wise_grad, value=1)
          std = state_sum.sqrt().add_(eps)
          param.addcdiv_(row_wise_grad, std, value=-clr)
  
file_path: torchrec/torchrec/optim/rowwise_adagrad.py
imports: from typing import Any, Dict, Iterable, List
  import torch
  from torch import Tensor
  from torch.optim.optimizer import Optimizer
label_desc: Use image node_id 2 for calling a global function with example usage: _single_tensor_adagrad(params, grads, state_sums, state_steps) without return types