code: def testScanSumWithDecaysWithSeqLen(self):
      with self.test_session() as sess:
          sequence = [[3, 1, 5, 2, 1], [-1.7, 1.2, 2.3, 0, 1]]
          decays = [[0.5, 0.9, 1.0, 0.1, 0.5], [0.9, 0.5, 0.0, 2, 0.8]]
          sequence_lengths = [0, 2]
          # 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.
          sequence_in = tf.transpose(
              tf.constant(sequence, dtype=tf.float32)
          )
          decays_in = tf.transpose(
              tf.constant(decays, dtype=tf.float32)
          )
          bootstrap = tf.constant([0, 1.5], dtype=tf.float32)
          result = sequence_ops.scan_discounted_sum(
              sequence_in,
              decays_in,
              bootstrap,
              reverse=False,
              sequence_lengths=sequence_lengths,
          )
          expected_result = tf.constant(
              [
                  [0, 0, 0, 0, 0],
                  [
                      -1.7 + 1.5 * 0.9,
                      (-1.7 + 1.5 * 0.9) * 0.5 + 1.2,
                      0,
                      0,
                      0,
                  ],
              ],
              dtype=tf.float32,
          )
          self.assertAllClose(
              sess.run(result), sess.run(tf.transpose(expected_result))
          )
  
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 4 for calling the ScanDiscountedSumTest obj's underlying member method code with example usage: obj.testScanSumWithDecaysWithSeqLen() without return types