code: def testAdvantagesMatchPrecomputedResult(self):
      advantages = value_ops.generalized_advantage_estimation(
          discounts=tf.constant(
              [
                  [1.0, 1.0, 1.0, 1.0, 0.0, 0.9, 0.9, 0.9, 0.0],
                  [1.0, 1.0, 1.0, 1.0, 0.0, 0.9, 0.9, 0.9, 0.0],
              ]
          ),
          rewards=tf.fill([2, 9], 1.0),
          values=tf.fill([2, 9], 3.0),
          final_value=tf.fill([2], 3.0),
          td_lambda=0.95,
          time_major=False,
      )
  
      # Precomputed according to equation (16) in paper.
      ground_truth = tf.constant(
          [
              [
                  2.0808625,
                  1.13775,
                  0.145,
                  -0.9,
                  -2.0,
                  0.56016475,
                  -0.16355,
                  -1.01,
                  -2.0,
              ],
              [
                  2.0808625,
                  1.13775,
                  0.145,
                  -0.9,
                  -2.0,
                  0.56016475,
                  -0.16355,
                  -1.01,
                  -2.0,
              ],
          ]
      )
  
      self.assertAllClose(advantages, ground_truth)
  
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 2 for calling the GeneralizedAdvantageEstimationTest obj's underlying member method code with example usage: obj.testAdvantagesMatchPrecomputedResult() without return types