docstr: scan_discounted_sum vs. higher-dimensional arguments.
docstr_tok: ["scan_discounted_sum","vs.","higher-dimensional","arguments","."]
code: def testScanSumWithDecaysReverse3DWithSeqLen(self):
      """scan_discounted_sum vs. higher-dimensional arguments."""
      with self.test_session() as sess:
          sequence = [
              [[3, 33], [1, 11], [5, 55]],
              [[-1.7, -17], [1.2, 12], [2.3, 23]],
          ]
          decays = [
              [[0.5, 5], [0.9, 9], [1.0, 10]],
              [[0.9, 9], [0.5, 5], [0.3, 3]],
          ]
          sequence_lengths = [2, 0]
          # 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), perm=[1, 0, 2]
          )
          decays_in = tf.transpose(
              tf.constant(decays, dtype=tf.float32), perm=[1, 0, 2]
          )
          bootstrap = tf.constant([[0, 0], [1.5, 15]], dtype=tf.float32)
          result = sequence_ops.scan_discounted_sum(
              sequence_in,
              decays_in,
              bootstrap,
              reverse=True,
              sequence_lengths=sequence_lengths,
          )
          expected_result = np.asarray(
              [
                  [[1 * 0.5 + 3, 11 * 5 + 33], [1, 11], [0, 0]],
                  [[0, 0], [0, 0], [0, 0]],
              ],
              dtype=np.float32,
          )
          self.assertAllClose(
              sess.run(result),
              np.transpose(expected_result, axes=[1, 0, 2]),
          )
  
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 9 for calling the ScanDiscountedSumTest obj's underlying member method code with example usage: obj.testScanSumWithDecaysReverse3DWithSeqLen() without return types