class_docstr: A tuple representing a batch of TimeSteps.
  
  Data type for off-policy algorithms, imitation learning and batch-RL.
  
  Attributes:
      env_spec (EnvSpec): Specification for the environment from
          which this data was sampled.
      episode_infos (dict[str, np.ndarray]): A dict of numpy arrays
          containing the episode-level information of each episode. Each
          value of this dict should be a numpy array of shape :math:`(N,
          S^*)`. For example, in goal-conditioned reinforcement learning this
          could contain the goal state for each episode.
      observations (numpy.ndarray): Non-flattened array of observations.
          Typically has shape (batch_size, S^*) (the unflattened state space
          of the current environment).
      actions (numpy.ndarray): Non-flattened array of actions. Must
          have shape (batch_size, S^*) (the unflattened action space of the
          current environment).
      rewards (numpy.ndarray): Array of rewards of shape (batch_size, 1).
      next_observation (numpy.ndarray): Non-flattened array of next
          observations. Has shape (batch_size, S^*). next_observations[i] was
          observed by the agent after taking actions[i].
      env_infos (dict): A dict arbitrary environment state
          information.
      agent_infos (dict): A dict of arbitrary agent state information. For
          example, this may contain the hidden states from an RNN policy.
      step_types (numpy.ndarray): A numpy array of `StepType with shape (
          batch_size,) containing the time step types for all transitions in
          this batch.
  
  Raises:
      ValueError: If any of the above attributes do not conform to their
          prescribed types and shapes.
class_docstr_tok: ["A","tuple","representing","a","batch","of","TimeSteps",".","Data","type","for","off-policy","algorithms",",","imitation","learning","and","batch-RL",".","Attributes",":","env_spec","(","EnvSpec",")",":","Specification","for","the","environment","from","which","this","data","was","sampled",".","episode_infos","(","dict","[","str",",","np.ndarray","]",")",":","A","dict","of","numpy","arrays","containing","the","episode-level","information","of","each","episode",".","Each","value","of","this","dict","should","be","a","numpy","array","of","shape",":","math",":","`","(","N",",","S^","*",")","`",".","For","example",",","in","goal-conditioned","reinforcement","learning","this","could","contain","the","goal","state","for","each","episode",".","observations","(","numpy.ndarray",")",":","Non-flattened","array","of","observations",".","Typically","has","shape","(","batch_size",",","S^","*",")","(","the","unflattened","state","space","of","the","current","environment",")",".","actions","(","numpy.ndarray",")",":","Non-flattened","array","of","actions",".","Must","have","shape","(","batch_size",",","S^","*",")","(","the","unflattened","action","space","of","the","current","environment",")",".","rewards","(","numpy.ndarray",")",":","Array","of","rewards","of","shape","(","batch_size",",","1",")",".","next_observation","(","numpy.ndarray",")",":","Non-flattened","array","of","next","observations",".","Has","shape","(","batch_size",",","S^","*",")",".","next_observations","[","i","]","was","observed","by","the","agent","after","taking","actions","[","i","]",".","env_infos","(","dict",")",":","A","dict","arbitrary","environment","state","information",".","agent_infos","(","dict",")",":","A","dict","of","arbitrary","agent","state","information",".","For","example",",","this","may","contain","the","hidden","states","from","an","RNN","policy",".","step_types","(","numpy.ndarray",")",":","A","numpy","array","of","`","StepType","with","shape","(","batch_size",",",")","containing","the","time","step","types","for","all","transitions","in","this","batch",".","Raises",":","ValueError",":","If","any","of","the","above","attributes","do","not","conform","to","their","prescribed","types","and","shapes","."]
docstr: Create a :class:`~TimeStepBatch` from a list of time step dictionaries.
  
  Args:
      env_spec (EnvSpec): Specification for the environment from which
          this data was sampled.
      ts_samples (list[dict[str, np.ndarray or dict[str, np.ndarray]]]):
          keys:
          * episode_infos (dict[str, np.ndarray]): A dict of numpy arrays
              containing the episode-level information of each episode.
              Each value of this dict must be a numpy array of shape
              :math:`(N, S^*)`. For example, in goal-conditioned
              reinforcement learning this could contain the goal state
              for each episode.
          * observations (numpy.ndarray): Non-flattened array of
              observations.
              Typically has shape (batch_size, S^*) (the unflattened
              state space of the current environment).
          * actions (numpy.ndarray): Non-flattened array of actions.
              Must have shape (batch_size, S^*) (the unflattened action
              space of the current environment).
          * rewards (numpy.ndarray): Array of rewards of shape (
              batch_size,) (1D array of length batch_size).
          * next_observation (numpy.ndarray): Non-flattened array of next
              observations. Has shape (batch_size, S^*).
              next_observations[i] was observed by the agent after
              taking actions[i].
          * env_infos (dict): A dict arbitrary environment state
              information.
          * agent_infos (dict): A dict of arbitrary agent
              state information. For example, this may contain the
              hidden states from an RNN policy.
          * step_types (numpy.ndarray): A numpy array of `StepType with
          shape (batch_size,) containing the time step types for all
              transitions in this batch.
  
  Returns:
      TimeStepBatch: The concatenation of samples.
  
  Raises:
      ValueError: If no dicts are provided.
docstr_tok: ["Create","a",":","class",":","`","~TimeStepBatch","`","from","a","list","of","time","step","dictionaries",".","Args",":","env_spec","(","EnvSpec",")",":","Specification","for","the","environment","from","which","this","data","was","sampled",".","ts_samples","(","list","[","dict","[","str",",","np.ndarray","or","dict","[","str",",","np.ndarray","]","]","]",")",":","keys",":","*","episode_infos","(","dict","[","str",",","np.ndarray","]",")",":","A","dict","of","numpy","arrays","containing","the","episode-level","information","of","each","episode",".","Each","value","of","this","dict","must","be","a","numpy","array","of","shape",":","math",":","`","(","N",",","S^","*",")","`",".","For","example",",","in","goal-conditioned","reinforcement","learning","this","could","contain","the","goal","state","for","each","episode",".","*","observations","(","numpy.ndarray",")",":","Non-flattened","array","of","observations",".","Typically","has","shape","(","batch_size",",","S^","*",")","(","the","unflattened","state","space","of","the","current","environment",")",".","*","actions","(","numpy.ndarray",")",":","Non-flattened","array","of","actions",".","Must","have","shape","(","batch_size",",","S^","*",")","(","the","unflattened","action","space","of","the","current","environment",")",".","*","rewards","(","numpy.ndarray",")",":","Array","of","rewards","of","shape","(","batch_size",",",")","(","1D","array","of","length","batch_size",")",".","*","next_observation","(","numpy.ndarray",")",":","Non-flattened","array","of","next","observations",".","Has","shape","(","batch_size",",","S^","*",")",".","next_observations","[","i","]","was","observed","by","the","agent","after","taking","actions","[","i","]",".","*","env_infos","(","dict",")",":","A","dict","arbitrary","environment","state","information",".","*","agent_infos","(","dict",")",":","A","dict","of","arbitrary","agent","state","information",".","For","example",",","this","may","contain","the","hidden","states","from","an","RNN","policy",".","*","step_types","(","numpy.ndarray",")",":","A","numpy","array","of","`","StepType","with","shape","(","batch_size",",",")","containing","the","time","step","types","for","all","transitions","in","this","batch",".","Returns",":","TimeStepBatch",":","The","concatenation","of","samples",".","Raises",":","ValueError",":","If","no","dicts","are","provided","."]
code: def from_time_step_list(cls, env_spec, ts_samples):
      """Create a :class:`~TimeStepBatch` from a list of time step dictionaries.
  
      Args:
          env_spec (EnvSpec): Specification for the environment from which
              this data was sampled.
          ts_samples (list[dict[str, np.ndarray or dict[str, np.ndarray]]]):
              keys:
              * episode_infos (dict[str, np.ndarray]): A dict of numpy arrays
                  containing the episode-level information of each episode.
                  Each value of this dict must be a numpy array of shape
                  :math:`(N, S^*)`. For example, in goal-conditioned
                  reinforcement learning this could contain the goal state
                  for each episode.
              * observations (numpy.ndarray): Non-flattened array of
                  observations.
                  Typically has shape (batch_size, S^*) (the unflattened
                  state space of the current environment).
              * actions (numpy.ndarray): Non-flattened array of actions.
                  Must have shape (batch_size, S^*) (the unflattened action
                  space of the current environment).
              * rewards (numpy.ndarray): Array of rewards of shape (
                  batch_size,) (1D array of length batch_size).
              * next_observation (numpy.ndarray): Non-flattened array of next
                  observations. Has shape (batch_size, S^*).
                  next_observations[i] was observed by the agent after
                  taking actions[i].
              * env_infos (dict): A dict arbitrary environment state
                  information.
              * agent_infos (dict): A dict of arbitrary agent
                  state information. For example, this may contain the
                  hidden states from an RNN policy.
              * step_types (numpy.ndarray): A numpy array of `StepType with
              shape (batch_size,) containing the time step types for all
                  transitions in this batch.
  
      Returns:
          TimeStepBatch: The concatenation of samples.
  
      Raises:
          ValueError: If no dicts are provided.
  
      """
      if len(ts_samples) < 1:
          raise ValueError("Please provide at least one dict")
  
      ts_batches = [
          TimeStepBatch(
              episode_infos=sample["episode_infos"],
              env_spec=env_spec,
              observations=sample["observations"],
              actions=sample["actions"],
              rewards=sample["rewards"],
              next_observations=sample["next_observations"],
              env_infos=sample["env_infos"],
              agent_infos=sample["agent_infos"],
              step_types=sample["step_types"],
          )
          for sample in ts_samples
      ]
  
      return TimeStepBatch.concatenate(*ts_batches)
  
imports: from dataclasses import dataclass
  import enum
  from typing import Dict, List
  import warnings
  import numpy
  from garage.np import concat_tensor_dict_list, pad_batch_array, slice_nested_dict, stack_tensor_dict_list
label_desc: Use image node_id 6 for calling the TimeStepBatch obj's underlying member method code with example usage: obj.from_time_step_list(cls, env_spec, ts_samples) and returns: TimeStepBatch