docstr: scan_discounted_sum vs. higher-dimensional arguments.
docstr_tok: ["scan_discounted_sum","vs.","higher-dimensional","arguments","."]
code: def testScanSumWithDecaysReverse3D(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]],
          ]
          # 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
          )
          expected_result = tf.constant(
              [
                  [
                      [(5 * 0.9 + 1) * 0.5 + 3, (55 * 9 + 11) * 5 + 33],
                      [5 * 0.9 + 1, 55 * 9 + 11],
                      [5, 55],
                  ],
                  [
                      [
                          ((2.3 + 0.3 * 1.5) * 0.5 + 1.2) * 0.9 - 1.7,
                          ((23 + 3 * 15) * 5 + 12) * 9 - 17,
                      ],
                      [
                          (2.3 + 0.3 * 1.5) * 0.5 + 1.2,
                          (23 + 3 * 15) * 5 + 12,
                      ],
                      [2.3 + 0.3 * 1.5, 23 + 3 * 15],
                  ],
              ],
              dtype=tf.float32,
          )
          self.assertAllClose(
              sess.run(result),
              sess.run(tf.transpose(expected_result, perm=[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 8 for calling the ScanDiscountedSumTest obj's underlying member method code with example usage: obj.testScanSumWithDecaysReverse3D() without return types