class_docstr: Exponential moving average (EMA) with exponential momentum strategy,
  which is used in YOLOX.
  
  Args:
      model (nn.Module): The model to be averaged.
      momentum (float): The momentum used for updating ema parameter.
          Ema's parameter are updated with the formula:
         `averaged_param = (1-momentum) * averaged_param + momentum *
         source_param`. Defaults to 0.0002.
      gamma (int): Use a larger momentum early in training and gradually
          annealing to a smaller value to update the ema model smoothly. The
          momentum is calculated as
          `(1 - momentum) * exp(-(1 + steps) / gamma) + momentum`.
          Defaults to 2000.
      interval (int): Interval between two updates. Defaults to 1.
      device (torch.device, optional): If provided, the averaged model will
          be stored on the :attr:`device`. Defaults to None.
      update_buffers (bool): if True, it will compute running averages for
          both the parameters and the buffers of the model. Defaults to
          False.
docstr: Compute the moving average of the parameters using the exponential
  momentum strategy.
  
  Args:
      averaged_param (Tensor): The averaged parameters.
      source_param (Tensor): The source parameters.
      steps (int): The number of times the parameters have been
          updated.
docstr_tok: ["Compute","the","moving","average","of","the","parameters","using","the","exponential","momentum","strategy",".","Args",":","averaged_param","(","Tensor",")",":","The","averaged","parameters",".","source_param","(","Tensor",")",":","The","source","parameters",".","steps","(","int",")",":","The","number","of","times","the","parameters","have","been","updated","."]
code: def avg_func(
      self, averaged_param: Tensor, source_param: Tensor, steps: int
  ) -> None:
      """Compute the moving average of the parameters using the exponential
      momentum strategy.
  
      Args:
          averaged_param (Tensor): The averaged parameters.
          source_param (Tensor): The source parameters.
          steps (int): The number of times the parameters have been
              updated.
      """
      momentum = (1 - self.momentum) * math.exp(
          -float(1 + steps) / self.gamma
      ) + self.momentum
      averaged_param.mul_(1 - momentum).add_(
          source_param, alpha=momentum
      )
  
file_path: mmdetection/mmdet/models/layers/ema.py
imports: import math
  from typing import Optional
  import torch
  import torch.nn
  from mmengine.model import ExponentialMovingAverage
  from torch import Tensor
  from mmdet.registry import MODELS
label_desc: Use image node_id 2 for calling the ExpMomentumEMA obj's underlying member method code with example usage: obj.avg_func(averaged_param, source_param, steps) without return types