class_docstr: An `EnvProblem` when observations are RGB arrays.
  
  This takes care of wrapping a rendered gym environment to behave like a
  `VideoProblem`. This class assumes the underlying gym environment is either a
  `gym_utils.RenderedEnv` or it natively returns rendered scene for
  observations. i.e. the underlying gym environment should have a
  `Box` observation space with the following shape: [frame_height, frame_width,
  channels]
  
  Note: The method resolution order for this class is:
  `RenderedEnvProblem`, `EnvProblem`, `Env`, `VideoProblem`, `Problem`
docstr: Transforms time step observations to frames of a video.
docstr_tok: ["Transforms","time","step","observations","to","frames","of","a","video","."]
code: def _generate_time_steps(self, trajectory_list):
      """Transforms time step observations to frames of a video."""
      for (
          time_step
      ) in gym_env_problem.GymEnvProblem._generate_time_steps(
          self, trajectory_list
      ):
          # Convert the rendered observations from numpy to png format.
          frame_np = np.array(
              time_step.pop(env_problem.OBSERVATION_FIELD)
          )
          frame_np = frame_np.reshape(
              [self.frame_height, self.frame_width, self.num_channels]
          )
          # TODO(msaffar) Add support for non RGB rendered environments
          frame = png.from_array(frame_np, "RGB", info={"bitdepth": 8})
          frame_buffer = six.BytesIO()
          frame.save(frame_buffer)
  
          # Put the encoded frame back.
          time_step[_IMAGE_ENCODED_FIELD] = [frame_buffer.getvalue()]
          time_step[_IMAGE_FORMAT_FIELD] = [_FORMAT]
          time_step[_IMAGE_HEIGHT_FIELD] = [self.frame_height]
          time_step[_IMAGE_WIDTH_FIELD] = [self.frame_width]
  
          # Add the frame number
          time_step[_FRAME_NUMBER_FIELD] = time_step[
              env_problem.TIMESTEP_FIELD
          ]
          yield time_step
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import png
  import six
  from tensor2tensor.data_generators import video_utils
  from tensor2tensor.envs import env_problem
  from tensor2tensor.envs import gym_env_problem
  from tensor2tensor.utils import contrib
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling the RenderedEnvProblem obj's underlying member method code with example usage: obj._generate_time_steps(trajectory_list) without return types