class_docstr: Exponential Moving Average of models weights
class_docstr_tok: ["Exponential","Moving","Average","of","models","weights"]
docstr: Returns the state of the ExponentialMovingAverage as a dict. This method is used by accelerate during
  checkpointing to save the ema state dict.
docstr_tok: ["Returns","the","state","of","the","ExponentialMovingAverage","as","a","dict",".","This","method","is","used","by","accelerate","during","checkpointing","to","save","the","ema","state","dict","."]
code: def state_dict(self) -> dict:
      r"""
      Returns the state of the ExponentialMovingAverage as a dict. This method is used by accelerate during
      checkpointing to save the ema state dict.
      """
      # Following PyTorch conventions, references to tensors are returned:
      # "returns a reference to the state and not its copy!" -
      # https://pytorch.org/tutorials/beginner/saving_loading_models.html#what-is-a-state-dict
      return {
          "decay": self.decay,
          "min_decay": self.min_decay,
          "optimization_step": self.optimization_step,
          "update_after_step": self.update_after_step,
          "use_ema_warmup": self.use_ema_warmup,
          "inv_gamma": self.inv_gamma,
          "power": self.power,
          "shadow_params": self.shadow_params,
      }
  
imports: import contextlib
  import copy
  import random
  from typing import Any, Dict, Iterable, List, Optional, Union
  import numpy
  import torch
  from torchvision import transforms
  from .models import UNet2DConditionModel
  from .utils import convert_state_dict_to_diffusers, convert_state_dict_to_peft, deprecate, is_peft_available, is_transformers_available
label_desc: Use image node_id 8 for calling the EMAModel obj's underlying member method code with example usage: obj.state_dict() and returns: dict