class_docstr: Base class for multi-agent RLModules.
  
  This class holds a mapping from module_ids to the underlying RLModules. It provides
  a convenient way of accessing each individual module, as well as accessing all of
  them with only one API call. Whether or not a given module is trainable is
  determined by the caller of this class (not the instance of this class itself).
  
  The extension of this class can include any arbitrary neural networks as part of
  the multi-agent module. For example, a multi-agent module can include a shared
  encoder network that is used by all the individual RLModules. It is up to the user
  to decide how to implement this class.
  
  The default implementation assumes the data communicated as input and output of
  the APIs in this class are `MultiAgentBatch` types. The `MultiAgentRLModule` simply
  loops through each `module_id`, and runs the forward pass of the corresponding
  `RLModule` object with the associated `SampleBatch` within the `MultiAgentBatch`.
  It also assumes that the underlying RLModules do not share any parameters or
  communication with one another. The behavior of modules with such advanced
  communication would be undefined by default. To share parameters or communication
  between the underlying RLModules, you should implement your own
  `MultiAgentRLModule` subclass.
class_docstr_tok: ["Base","class","for","multi-agent","RLModules",".","This","class","holds","a","mapping","from","module_ids","to","the","underlying","RLModules",".","It","provides","a","convenient","way","of","accessing","each","individual","module",",","as","well","as","accessing","all","of","them","with","only","one","API","call",".","Whether","or","not","a","given","module","is","trainable","is","determined","by","the","caller","of","this","class","(","not","the","instance","of","this","class","itself",")",".","The","extension","of","this","class","can","include","any","arbitrary","neural","networks","as","part","of","the","multi-agent","module",".","For","example",",","a","multi-agent","module","can","include","a","shared","encoder","network","that","is","used","by","all","the","individual","RLModules",".","It","is","up","to","the","user","to","decide","how","to","implement","this","class",".","The","default","implementation","assumes","the","data","communicated","as","input","and","output","of","the","APIs","in","this","class","are","`","MultiAgentBatch","`","types",".","The","`","MultiAgentRLModule","`","simply","loops","through","each","`","module_id","`",",","and","runs","the","forward","pass","of","the","corresponding","`","RLModule","`","object","with","the","associated","`","SampleBatch","`","within","the","`","MultiAgentBatch","`",".","It","also","assumes","that","the","underlying","RLModules","do","not","share","any","parameters","or","communication","with","one","another",".","The","behavior","of","modules","with","such","advanced","communication","would","be","undefined","by","default",".","To","share","parameters","or","communication","between","the","underlying","RLModules",",","you","should","implement","your","own","`","MultiAgentRLModule","`","subclass","."]
docstr: Calls the given function with each (module_id, module).
  
  Args:
      func: The function to call with each (module_id, module) tuple.
  
  Returns:
      The lsit of return values of all calls to
      `func([module_id, module, **kwargs])`.
code: def foreach_module(
      self,
      func: Callable[[ModuleID, RLModule, Optional[Any]], T],
      **kwargs,
  ) -> List[T]:
      """Calls the given function with each (module_id, module).
  
      Args:
          func: The function to call with each (module_id, module) tuple.
  
      Returns:
          The lsit of return values of all calls to
          `func([module_id, module, **kwargs])`.
      """
      return [
          func(module_id, module, **kwargs)
          for module_id, module in self._rl_modules.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 8 for calling the MultiAgentRLModule obj's underlying member method code with example usage: obj.foreach_module(func) and returns: unknown