class_docstr: Holds a collection of random number generators.
class_docstr_tok: ["Holds","a","collection","of","random","number","generators","."]
code: def load_state_dict(self, state_dict: Mapping[str, Any]) -> None:
      try:
          states = state_dict["generators"]
      except KeyError:
          raise ValueError(
              "`state_dict` must contain an item named `generators`."
          )
  
      if not isinstance(states, list):
          raise ValueError(
              f"The `generators` item of `state_dict` must be of type `{list}`, but is of type `{type(states)}` instead."
          )
  
      if len(states) != len(self.generators):
          raise ValueError(
              f"The number of generators in `state_dict` must match the number of generators in the bag ({len(self.generators)}), but is {len(states)} instead."
          )
  
      for idx, state in enumerate(states):
          if not isinstance(state, Tensor):
              raise ValueError(
                  f"The generator states in `state_dict` must be of type `{Tensor}`, but the element at index {idx} is of type `{type(state)}` instead."
              )
  
          self.generators[idx].set_state(state.clone())
  
file_path: fairseq2/src/fairseq2/utils/rng.py
imports: from __future__ import annotations
  from typing import Any, Dict, List, Mapping
  import torch
  from torch import Generator, Tensor
  from fairseq2.typing import CPU, Device
label_desc: Use image node_id 6 for calling the RNGBag obj's underlying member method code with example usage: obj.load_state_dict(state_dict) without return types