code: def testMultistepForwardView(self):
      with self.test_session() as sess:
          # Define input data.
          rewards = [[1, 0, -1, 0, 1], [0.5, 0.8, -0.7, 0.0, 2.1]]
          pcontinues = [
              [0.5, 0.9, 1.0, 0.5, 0.8],
              [0.9, 0.5, 0.3, 0.8, 0.7],
          ]
          state_values = [[3, 1, 5, -5, 3], [-1.7, 1.2, 2.3, 2.2, 2.7]]
          lambda_ = 0.75
          # Evaluate expected complex backups at all time-steps for both batches.
          expected_result = []
          for b in xrange(0, 2):
              expected_result.append(
                  get_complex_n_step_backup_at_all_times(
                      rewards[b],
                      pcontinues[b],
                      state_values[b],
                      lambda_,
                  )
              )
          # Only partially-specify the input shapes - verifies that the
          # dynamically sized Tensors are handled correctly.
          state_values_pl = tf.placeholder(
              tf.float32, shape=[None, None]
          )
          rewards_pl = tf.placeholder(tf.float32, shape=[None, None])
          pcontinues_pl = tf.placeholder(tf.float32, shape=[None, None])
          # We use transpose because it is easier to define the input data in
          # BxT (batch x time) form, while scan_discounted_sum assumes TxB form.
          state_values_in = tf.transpose(state_values_pl)
          rewards_in = tf.transpose(rewards_pl)
          pcontinues_in = tf.transpose(pcontinues_pl)
          expected = tf.transpose(
              tf.constant(expected_result, dtype=tf.float32)
          )
          # Evaluate complex backups.
          result = sequence_ops.multistep_forward_view(
              rewards_in, pcontinues_in, state_values_in, lambda_
          )
          feed_dict = {
              state_values_pl: state_values,
              rewards_pl: rewards,
              pcontinues_pl: pcontinues,
          }
          self.assertAllClose(
              sess.run(result, feed_dict=feed_dict), sess.run(expected)
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from six.moves import xrange
  import tensorflow.compat.v1
  from trfl import sequence_ops
label_desc: Use image node_id 1 for calling the MultistepForwardViewTest obj's underlying member method code with example usage: obj.testMultistepForwardView() without return types