class_docstr: Rollouts a given policy in a given environment, recording the trajectory (in the form of raw actions
  and observations).
  
  Works with both standard and vectorized environments.
  
  :param env: Environment to run rollouts in. Will be reset before the first rollout.
  :param record_logits: Whether to record the policy logits.
  :param record_step_stats: Whether to record step statistics.
  :param record_episode_stats: Whether to record episode stats (happens only when an episode is done).
  :param record_next_observations: Whether to record next observation (i.e. observation following the action taken).
  :param terminate_on_done: Whether to end the rollout when the env is done (by default resets the env and continues
                            until the desired number of steps has been recorded). Only applicable in non-vectorized
                            scenarios.
class_docstr_tok: ["Rollouts","a","given","policy","in","a","given","environment",",","recording","the","trajectory","(","in","the","form","of","raw","actions","and","observations",")",".","Works","with","both","standard","and","vectorized","environments",".",":","param","env",":","Environment","to","run","rollouts","in",".","Will","be","reset","before","the","first","rollout",".",":","param","record_logits",":","Whether","to","record","the","policy","logits",".",":","param","record_step_stats",":","Whether","to","record","step","statistics",".",":","param","record_episode_stats",":","Whether","to","record","episode","stats","(","happens","only","when","an","episode","is","done",")",".",":","param","record_next_observations",":","Whether","to","record","next","observation","(","i.e",".","observation","following","the","action","taken",")",".",":","param","terminate_on_done",":","Whether","to","end","the","rollout","when","the","env","is","done","(","by","default","resets","the","env","and","continues","until","the","desired","number","of","steps","has","been","recorded",")",".","Only","applicable","in","non-vectorized","scenarios","."]
docstr: Obtain a single value from the epoch statistics dict.
  
  :param event: The event interface method of the value in question.
  :param name: The *output_name* of the statistics in case it has been specified in
               :func:`maze.core.log_stats.event_decorators.define_epoch_stats`
  :param level: Must be set to `LogStatsLevel.EPOCH`, step or episode statistics are not propagated.
docstr_tok: ["Obtain","a","single","value","from","the","epoch","statistics","dict",".",":","param","event",":","The","event","interface","method","of","the","value","in","question",".",":","param","name",":","The","*","output_name","*","of","the","statistics","in","case","it","has","been","specified","in",":","func",":","`","maze.core.log_stats.event_decorators.define_epoch_stats","`",":","param","level",":","Must","be","set","to","`","LogStatsLevel.EPOCH","`",",","step","or","episode","statistics","are","not","propagated","."]
code: def get_stats_value(
      self,
      event: Callable,
      level: LogStatsLevel,
      name: Optional[str] = None,
  ) -> LogStatsValue:
      """Obtain a single value from the epoch statistics dict.
  
      :param event: The event interface method of the value in question.
      :param name: The *output_name* of the statistics in case it has been specified in
                   :func:`maze.core.log_stats.event_decorators.define_epoch_stats`
      :param level: Must be set to `LogStatsLevel.EPOCH`, step or episode statistics are not propagated.
      """
      assert level == LogStatsLevel.EPOCH
  
      return self.env.get_stats_value(event, level, name)
  
file_path: maze/maze/core/rollout/rollout_generator.py
imports: from copy import deepcopy
  from typing import Union, Optional, Any, Callable
  import numpy
  import torch
  from maze.core.agent.policy import Policy
  from maze.core.agent.torch_policy import TorchPolicy
  from maze.core.env.maze_env import MazeEnv
  from maze.core.log_stats.log_stats import LogStatsLevel, LogStatsAggregator, LogStatsValue
  from maze.core.trajectory_recording.records.spaces_record import SpacesRecord
  from maze.core.trajectory_recording.records.structured_spaces_record import StructuredSpacesRecord
  from maze.core.trajectory_recording.records.trajectory_record import SpacesTrajectoryRecord
  from maze.core.wrappers.log_stats_wrapper import LogStatsWrapper
  from maze.perception.perception_utils import convert_to_numpy
  from maze.train.parallelization.vector_env.structured_vector_env import StructuredVectorEnv
label_desc: Use image node_id 3 for calling the RolloutGenerator obj's underlying member method code with example usage: obj.get_stats_value(event, level, name) and returns: self