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: Concatenate two or more :class:`TimeStepBatch`s.
  
  Args:
      batches (list[TimeStepBatch]): Batches to concatenate.
  
  Returns:
      TimeStepBatch: The concatenation of the batches.
  
  Raises:
      ValueError: If no TimeStepBatches are provided.
docstr_tok: ["Concatenate","two","or","more",":","class",":","`","TimeStepBatch","`","s",".","Args",":","batches","(","list","[","TimeStepBatch","]",")",":","Batches","to","concatenate",".","Returns",":","TimeStepBatch",":","The","concatenation","of","the","batches",".","Raises",":","ValueError",":","If","no","TimeStepBatches","are","provided","."]
code: def concatenate(cls, *batches):
      """Concatenate two or more :class:`TimeStepBatch`s.
  
      Args:
          batches (list[TimeStepBatch]): Batches to concatenate.
  
      Returns:
          TimeStepBatch: The concatenation of the batches.
  
      Raises:
          ValueError: If no TimeStepBatches are provided.
  
      """
      if len(batches) < 1:
          raise ValueError(
              "Please provide at least one TimeStepBatch to "
              "concatenate"
          )
      episode_infos = {
          k: np.concatenate([b.episode_infos[k] for b in batches])
          for k in batches[0].episode_infos.keys()
      }
      env_infos = {
          k: np.concatenate([b.env_infos[k] for b in batches])
          for k in batches[0].env_infos.keys()
      }
      agent_infos = {
          k: np.concatenate([b.agent_infos[k] for b in batches])
          for k in batches[0].agent_infos.keys()
      }
  
      return cls(
          env_spec=batches[0].env_spec,
          episode_infos=episode_infos,
          observations=np.concatenate(
              [batch.observations for batch in batches]
          ),
          actions=np.concatenate([batch.actions for batch in batches]),
          rewards=np.concatenate([batch.rewards for batch in batches]),
          next_observations=np.concatenate(
              [batch.next_observations for batch in batches]
          ),
          env_infos=env_infos,
          agent_infos=agent_infos,
          step_types=np.concatenate(
              [batch.step_types for batch in 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 2 for calling the TimeStepBatch obj's underlying member method code with example usage: obj.concatenate(cls) and returns: cls