class_docstr: Coordinator of n (possibly remote) Learner workers.
  
  Each Learner worker has a copy of the RLModule, the loss function(s), and
  one or more optimizers.
docstr: Performs gradient based update(s) on the Learner(s), based on given episodes.
  
  Args:
      episodes: A list of Episodes to process and perform the update
          for. If there are more than one Learner workers, the list of episodes
          is split amongst these and one list shard is sent to each Learner.
      async_update: Whether the update request(s) to the Learner workers should be
          sent asynchronously. If True, will return NOT the results from the
          update on the given data, but all results from prior asynchronous update
          requests that have not been returned thus far.
      minibatch_size: The minibatch size to use for the update.
      num_iters: The number of complete passes over all the sub-batches in the
          input multi-agent batch.
      reduce_fn: An optional callable to reduce the results from a list of the
          Learner actors into a single result. This can be any arbitrary function
          that takes a list of dictionaries and returns a single dictionary. For
          example, you can either take an average (default) or concatenate the
          results (for example for metrics) or be more selective about you want to
          report back to the algorithm's training_step. If None is passed, the
          results will not get reduced.
  
  Returns:
      If async_update is False, a dictionary with the reduced results of the
      updates from the Learner(s) or a list of dictionaries of results from the
      updates from the Learner(s).
      If async_update is True, a list of list of dictionaries of results, where
      the outer list corresponds to separate previous calls to this method, and
      the inner list corresponds to the results from each Learner(s). Or if the
      results are reduced, a list of dictionaries of the reduced results from each
      call to async_update that is ready.
docstr_tok: ["Performs","gradient","based","update","(","s",")","on","the","Learner","(","s",")",",","based","on","given","episodes",".","Args",":","episodes",":","A","list","of","Episodes","to","process","and","perform","the","update","for",".","If","there","are","more","than","one","Learner","workers",",","the","list","of","episodes","is","split","amongst","these","and","one","list","shard","is","sent","to","each","Learner",".","async_update",":","Whether","the","update","request","(","s",")","to","the","Learner","workers","should","be","sent","asynchronously",".","If","True",",","will","return","NOT","the","results","from","the","update","on","the","given","data",",","but","all","results","from","prior","asynchronous","update","requests","that","have","not","been","returned","thus","far",".","minibatch_size",":","The","minibatch","size","to","use","for","the","update",".","num_iters",":","The","number","of","complete","passes","over","all","the","sub-batches","in","the","input","multi-agent","batch",".","reduce_fn",":","An","optional","callable","to","reduce","the","results","from","a","list","of","the","Learner","actors","into","a","single","result",".","This","can","be","any","arbitrary","function","that","takes","a","list","of","dictionaries","and","returns","a","single","dictionary",".","For","example",",","you","can","either","take","an","average","(","default",")","or","concatenate","the","results","(","for","example","for","metrics",")","or","be","more","selective","about","you","want","to","report","back","to","the","algorithm","'s","training_step",".","If","None","is","passed",",","the","results","will","not","get","reduced",".","Returns",":","If","async_update","is","False",",","a","dictionary","with","the","reduced","results","of","the","updates","from","the","Learner","(","s",")","or","a","list","of","dictionaries","of","results","from","the","updates","from","the","Learner","(","s",")",".","If","async_update","is","True",",","a","list","of","list","of","dictionaries","of","results",",","where","the","outer","list","corresponds","to","separate","previous","calls","to","this","method",",","and","the","inner","list","corresponds","to","the","results","from","each","Learner","(","s",")",".","Or","if","the","results","are","reduced",",","a","list","of","dictionaries","of","the","reduced","results","from","each","call","to","async_update","that","is","ready","."]
code: def update_from_episodes(
      self,
      episodes: List[EpisodeType],
      *,
      async_update: bool = False,
      reduce_fn: Optional[
          Callable[[List[Dict[str, Any]]], ResultDict]
      ] = (_reduce_mean_results),
      # TODO (sven): Deprecate the following args. They should be extracted from the
      #  LearnerHyperparameters of those specific algorithms that actually require
      #  these settings.
      minibatch_size: Optional[int] = None,
      num_iters: int = 1,
  ) -> Union[
      Dict[str, Any], List[Dict[str, Any]], List[List[Dict[str, Any]]]
  ]:
      """Performs gradient based update(s) on the Learner(s), based on given episodes.
  
      Args:
          episodes: A list of Episodes to process and perform the update
              for. If there are more than one Learner workers, the list of episodes
              is split amongst these and one list shard is sent to each Learner.
          async_update: Whether the update request(s) to the Learner workers should be
              sent asynchronously. If True, will return NOT the results from the
              update on the given data, but all results from prior asynchronous update
              requests that have not been returned thus far.
          minibatch_size: The minibatch size to use for the update.
          num_iters: The number of complete passes over all the sub-batches in the
              input multi-agent batch.
          reduce_fn: An optional callable to reduce the results from a list of the
              Learner actors into a single result. This can be any arbitrary function
              that takes a list of dictionaries and returns a single dictionary. For
              example, you can either take an average (default) or concatenate the
              results (for example for metrics) or be more selective about you want to
              report back to the algorithm's training_step. If None is passed, the
              results will not get reduced.
  
      Returns:
          If async_update is False, a dictionary with the reduced results of the
          updates from the Learner(s) or a list of dictionaries of results from the
          updates from the Learner(s).
          If async_update is True, a list of list of dictionaries of results, where
          the outer list corresponds to separate previous calls to this method, and
          the inner list corresponds to the results from each Learner(s). Or if the
          results are reduced, a list of dictionaries of the reduced results from each
          call to async_update that is ready.
      """
      return self._update(
          batch=None,
          episodes=episodes,
          async_update=async_update,
          reduce_fn=reduce_fn,
          minibatch_size=minibatch_size,
          num_iters=num_iters,
      )
  
imports: from collections import defaultdict, Counter
  from functools import partial
  import pathlib
  from typing import Any, Callable, Dict, List, Optional, Set, Type, Union
  import uuid
  import ray
  from ray.rllib.algorithms.algorithm_config import AlgorithmConfig
  from ray.rllib.core.learner.learner import Learner
  from ray.rllib.core.learner.reduce_result_dict_fn import _reduce_mean_results
  from ray.rllib.core.rl_module.rl_module import SingleAgentRLModuleSpec, RLMODULE_STATE_DIR_NAME
  from ray.rllib.policy.sample_batch import MultiAgentBatch
  from ray.rllib.utils.actor_manager import FaultTolerantActorManager
  from ray.rllib.utils.deprecation import Deprecated, deprecation_warning
  from ray.rllib.utils.minibatch_utils import ShardBatchIterator, ShardEpisodesIterator
  from ray.rllib.utils.numpy import convert_to_numpy
  from ray.rllib.utils.typing import EpisodeType, ModuleID, ResultDict, RLModuleSpec, ShouldModuleBeUpdatedFn
  from ray.train._internal.backend_executor import BackendExecutor
  from ray.tune.utils.file_transfer import sync_dir_between_nodes
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 6 for calling the LearnerGroup obj's underlying member method code with example usage: obj.update_from_episodes(episodes) and returns: self