code: def _naive_gae_as_ground_truth(
      discounts, rewards, values, final_value, td_lambda
  ):
      """A naive GAE closely resembles equation (16) in the paper.
  
      Slow, for testing purpose only.
      For full paper see https://arxiv.org/abs/1506.02438.pdf
      Args:
        discounts: `np.array` with shape [T, B].
        rewards: `np.array` with shape [T, B].
        values: `np.array` with shape [T, B].
        final_value: `np.array` with shape [B].
        td_lambda: A float scalar.
  
      Returns:
        A `np.array` with shape[T, B] representing the advantages.
      """
  
      episode_length = len(values)
      values_t_puls_1 = np.concatenate(
          [values, final_value[None, :]], axis=0
      )
  
      delta_v = [
          (
              rewards[t]
              + discounts[t] * values_t_puls_1[t + 1]
              - values_t_puls_1[t]
          )
          for t in range(episode_length)
      ]
      weighted_discounts = discounts * td_lambda
      advantages = []
      for s in range(episode_length):
          advantage = np.copy(delta_v[s])
          for t in range(s + 1, episode_length):
              advantage += (
                  np.prod(weighted_discounts[s:t], axis=0) * delta_v[t]
              )
          advantages.append(advantage)
  
      return np.array(advantages)
  
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 1 for calling a global function with example usage: _naive_gae_as_ground_truth(discounts, rewards, values, final_value, td_lambda) and returns: np