code: def testToTransition(self):
      first = ts.StepType.FIRST
      mid = ts.StepType.MID
      last = ts.StepType.LAST
  
      # Define a batch size 1, 3-step trajectory.
      traj = trajectory.Trajectory(
          step_type=np.array([[first, mid, last]]),
          next_step_type=np.array([[mid, last, first]]),
          observation=np.array([[10.0, 20.0, 30.0]]),
          action=np.array([[11.0, 22.0, 33.0]]),
          # reward at step 2 is an invalid dummy reward.
          reward=np.array([[0.0, 1.0, 2.0]]),
          discount=np.array([[1.0, 1.0, 0.0]]),
          policy_info=np.array([[1.0, 2.0, 3.0]]),
      )
  
      transition = trajectory.to_transition(traj)
      self.assertIsInstance(transition, trajectory.Transition)
      time_steps, policy_steps, next_time_steps = transition
  
      self.assertAllEqual(
          time_steps.step_type, np.array([[first, mid]])
      )
      self.assertAllEqual(
          time_steps.observation, np.array([[10.0, 20.0]])
      )
      # reward and discount are filled with zero (dummy) values
      self.assertAllEqual(time_steps.reward, np.array([[0.0, 0.0]]))
      self.assertAllEqual(time_steps.discount, np.array([[0.0, 0.0]]))
  
      self.assertAllEqual(
          next_time_steps.step_type, np.array([[mid, last]])
      )
      self.assertAllEqual(
          next_time_steps.observation, np.array([[20.0, 30.0]])
      )
      self.assertAllEqual(
          next_time_steps.reward, np.array([[0.0, 1.0]])
      )
      self.assertAllEqual(
          next_time_steps.discount, np.array([[1.0, 1.0]])
      )
  
      self.assertAllEqual(policy_steps.action, np.array([[11.0, 22.0]]))
      self.assertAllEqual(policy_steps.info, np.array([[1.0, 2.0]]))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import sys
  import numpy
  import tensorflow
  from tf_agents.drivers import dynamic_episode_driver
  from tf_agents.drivers import test_utils
  from tf_agents.environments import tf_py_environment
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  from tf_agents.utils import test_utils
label_desc: Use image node_id 13 for calling the TrajectoryTest obj's underlying member method code with example usage: obj.testToTransition() without return types