class_docstr: Multi step advantage actor critic.
      
code: def __init__(
      self,
      algorithm_config: ImpalaAlgorithmConfig,
      rollout_generator: DistributedActors,
      evaluator: Optional[RolloutEvaluator],
      model: TorchActorCritic,
      model_selection: Optional[BestModelSelection],
  ):
      super().__init__(
          algorithm_config,
          rollout_generator,
          evaluator,
          model,
          model_selection,
      )
  
      # inject statistics directly into the epoch log
      epoch_stats = self.rollout_generator.get_epoch_stats_aggregator()
      self.impala_events = epoch_stats.create_event_topic(ImpalaEvents)
  
imports: import time
  from collections import defaultdict
  from typing import Optional
  import torch
  from maze.core.agent.torch_actor_critic import TorchActorCritic
  from maze.core.annotations import override
  from maze.core.trajectory_recording.records.structured_spaces_record import StructuredSpacesRecord
  from maze.perception.perception_utils import map_nested_structure
  from maze.train.parallelization.distributed_actors.distributed_actors import DistributedActors
  from maze.train.trainers.common.actor_critic.actor_critic_trainer import ActorCritic
  from maze.train.trainers.common.evaluators.rollout_evaluator import RolloutEvaluator
  from maze.train.trainers.common.model_selection.best_model_selection import BestModelSelection
  from maze.train.trainers.common.trainer import Trainer
  from maze.train.trainers.impala import impala_vtrace
  from maze.train.trainers.impala.impala_algorithm_config import ImpalaAlgorithmConfig
  from maze.train.trainers.impala.impala_events import ImpalaEvents
label_desc: Use image node_id 1 to create a new IMPALA object from inherited base classes: ActorCritic with example: obj = IMPALA(algorithm_config, rollout_generator, evaluator, model, model_selection)