code: def testScanSumWithDecaysReverse(self):
      with self.test_session() as sess:
          sequence = [[3, 1, 5], [-1.7, 1.2, 2.3]]
          decays = [[0.5, 0.9, 1.0], [0.9, 0.5, 0.3]]
          # 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=True
          )
          expected_result = tf.constant(
              [
                  [(5 * 0.9 + 1) * 0.5 + 3, 5 * 0.9 + 1, 5],
                  [
                      ((2.3 + 0.3 * 1.5) * 0.5 + 1.2) * 0.9 - 1.7,
                      (2.3 + 0.3 * 1.5) * 0.5 + 1.2,
                      2.3 + 0.3 * 1.5,
                  ],
              ],
              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 6 for calling the ScanDiscountedSumTest obj's underlying member method code with example usage: obj.testScanSumWithDecaysReverse() without return types