class_docstr: Basically a batch of active trajectories and a list of completed ones.
class_docstr_tok: ["Basically","a","batch","of","active","trajectories","and","a","list","of","completed","ones","."]
docstr: Pads the observations in all the trajectories and returns them.
  
  Args:
    boundary: integer, Observations will be padded to (n * boundary) + 1 where
      n is an integer.
    len_history_for_policy: int, For each trajectory return only the last
      `len_history_for_policy` observations. Set to None for all the
      observations.
  
  Returns:
    padded_observations: (self.batch_size, n * boundary + 1) + OBS
code: def observations_np(self, boundary=20, len_history_for_policy=20):
      """Pads the observations in all the trajectories and returns them.
  
      Args:
        boundary: integer, Observations will be padded to (n * boundary) + 1 where
          n is an integer.
        len_history_for_policy: int, For each trajectory return only the last
          `len_history_for_policy` observations. Set to None for all the
          observations.
  
      Returns:
        padded_observations: (self.batch_size, n * boundary + 1) + OBS
      """
      list_observations_np_ts = [
          t.last_n_observations_np(n=len_history_for_policy)
          for t in self.trajectories
      ]
      # Every element in `list_observations_np_ts` is shaped (t,) + OBS
      OBS = list_observations_np_ts[0].shape[
          1:
      ]  # pylint: disable=invalid-name
  
      trajectory_lengths = np.stack(
          [obs.shape[0] for obs in list_observations_np_ts]
      )
  
      t_max = max(trajectory_lengths)
      # t_max is rounded to the next multiple of `boundary`
      boundary = int(boundary)
      bucket_length = boundary * int(np.ceil(float(t_max) / boundary))
  
      def padding_config(obs):
          # We're padding the first axis only, since that is the time-step.
          num_to_pad = bucket_length + 1 - obs.shape[0]
          return [(0, num_to_pad)] + [(0, 0)] * len(OBS)
  
      return (
          np.stack(
              [
                  np.pad(obs, padding_config(obs), "constant")
                  for obs in list_observations_np_ts
              ]
          ),
          trajectory_lengths,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import pickle
  import re
  import sys
  import time
  from absl import logging
  import cloudpickle
  import numpy
  from tensor2tensor.envs import time_step
  import tensorflow.compat.v1
label_desc: Use image node_id 17 for calling the BatchTrajectory obj's underlying member method code with example usage: obj.observations_np(boundary, len_history_for_policy) and returns: np,  trajectory_lengths, unknown