code: def testDiscountedReturnWithFinalValueMatchPrecomputedResult(self):
      discounted_return = value_ops.discounted_return(
          rewards=tf.constant([1] * 9, dtype=tf.float32),
          discounts=tf.constant(
              [1, 1, 1, 1, 0, 0.9, 0.9, 0.9, 0.9], dtype=tf.float32
          ),
          final_value=tf.constant(8, dtype=tf.float32),
      )
  
      expected = [
          5,
          4,
          3,
          2,
          1,
          8 * 0.9**4 + 3.439,
          8 * 0.9**3 + 2.71,
          8 * 0.9**2 + 1.9,
          8 * 0.9 + 1,
      ]
  
      self.evaluate(tf.compat.v1.global_variables_initializer())
      self.assertAllClose(discounted_return, expected)
  
file_path: agents/tf_agents/utils/value_ops_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tf_agents.utils import value_ops
label_desc: Use image node_id 3 for calling the DiscountedReturnTest obj's underlying member method code with example usage: obj.testDiscountedReturnWithFinalValueMatchPrecomputedResult() without return types