class_docstr: A utility spec class to make it constructing MARL modules easier.
  
  
  Users can extend this class to modify the behavior of base class. For example to
  share neural networks across the modules, the build method can be overriden to
  create the shared module first and then pass it to custom module classes that would
  then use it as a shared module.
  
  Args:
      marl_module_class: The class of the multi-agent RLModule to construct. By
          default it is set to MultiAgentRLModule class. This class simply loops
          throught each module and calls their foward methods.
      module_specs: The module specs for each individual module. It can be either a
          SingleAgentRLModuleSpec used for all module_ids or a dictionary mapping
          from module IDs to SingleAgentRLModuleSpecs for each individual module.
      load_state_path: The path to the module state to load from. NOTE: This must be
          an absolute path. NOTE: If the load_state_path of this spec is set, and
          the load_state_path of one of the SingleAgentRLModuleSpecs' is also set,
          the weights of that RL Module will be loaded from the path specified in
          the SingleAgentRLModuleSpec. This is useful if you want to load the weights
          of a MARL module and also manually load the weights of some of the RL
          modules within that MARL module from other checkpoints.
      modules_to_load: A set of module ids to load from the checkpoint. This is
          only used if load_state_path is set. If this is None, all modules are
          loaded.
class_docstr_tok: ["A","utility","spec","class","to","make","it","constructing","MARL","modules","easier",".","Users","can","extend","this","class","to","modify","the","behavior","of","base","class",".","For","example","to","share","neural","networks","across","the","modules",",","the","build","method","can","be","overriden","to","create","the","shared","module","first","and","then","pass","it","to","custom","module","classes","that","would","then","use","it","as","a","shared","module",".","Args",":","marl_module_class",":","The","class","of","the","multi-agent","RLModule","to","construct",".","By","default","it","is","set","to","MultiAgentRLModule","class",".","This","class","simply","loops","throught","each","module","and","calls","their","foward","methods",".","module_specs",":","The","module","specs","for","each","individual","module",".","It","can","be","either","a","SingleAgentRLModuleSpec","used","for","all","module_ids","or","a","dictionary","mapping","from","module","IDs","to","SingleAgentRLModuleSpecs","for","each","individual","module",".","load_state_path",":","The","path","to","the","module","state","to","load","from",".","NOTE",":","This","must","be","an","absolute","path",".","NOTE",":","If","the","load_state_path","of","this","spec","is","set",",","and","the","load_state_path","of","one","of","the","SingleAgentRLModuleSpecs","'","is","also","set",",","the","weights","of","that","RL","Module","will","be","loaded","from","the","path","specified","in","the","SingleAgentRLModuleSpec",".","This","is","useful","if","you","want","to","load","the","weights","of","a","MARL","module","and","also","manually","load","the","weights","of","some","of","the","RL","modules","within","that","MARL","module","from","other","checkpoints",".","modules_to_load",":","A","set","of","module","ids","to","load","from","the","checkpoint",".","This","is","only","used","if","load_state_path","is","set",".","If","this","is","None",",","all","modules","are","loaded","."]
docstr: Converts the MultiAgentRLModuleSpec to a dictionary.
code: def to_dict(self) -> Dict[str, Any]:
      """Converts the MultiAgentRLModuleSpec to a dictionary."""
      return {
          "marl_module_class": serialize_type(self.marl_module_class),
          "module_specs": {
              module_id: module_spec.to_dict()
              for module_id, module_spec in self.module_specs.items()
          },
      }
  
imports: from dataclasses import dataclass, field
  import pathlib
  import pprint
  from typing import Any, Callable, Dict, KeysView, List, Mapping, Optional, Set, Type, Union
  from ray.util.annotations import PublicAPI
  from ray.rllib.utils.annotations import override, ExperimentalAPI
  from ray.rllib.utils.nested_dict import NestedDict
  from ray.rllib.core.models.specs.typing import SpecType
  from ray.rllib.policy.sample_batch import MultiAgentBatch
  from ray.rllib.core.rl_module.rl_module import RLModule, RLMODULE_METADATA_FILE_NAME, RLMODULE_STATE_DIR_NAME, SingleAgentRLModuleSpec
  from ray.rllib.utils.annotations import OverrideToImplementCustomLogic
  from ray.rllib.utils.policy import validate_policy_id
  from ray.rllib.utils.serialization import serialize_type, deserialize_type
  from ray.rllib.utils.typing import T
label_desc: Use image node_id 7 for calling the MultiAgentRLModuleSpec obj's underlying member method code with example usage: obj.to_dict() and returns: dict