code: def _numpy_discounted_return(rewards, discounts, final_value):
      """A naive reward to do implemented in python.
  
      Slow, for testing purpose only.
      Args:
        rewards: `np.array` with shape [T, B].
        discounts: `np.array` with shape [T, B].
        final_value: `np.array` with shape [B].
  
      Returns:
        A `np.array` with shape[T, B] representing the target values.
      """
      if final_value is None:
          final_value = np.zeros_like(rewards[-1])
  
      discounted_returns = np.zeros_like(rewards)
      accumulated_rewards = final_value
      for t in reversed(range(len(rewards))):
          discounted_returns[t] = (
              rewards[t] + discounts[t] * accumulated_rewards
          )
          accumulated_rewards = discounted_returns[t]
      return discounted_returns
  
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 a global function with example usage: _numpy_discounted_return(rewards, discounts, final_value) and returns: discounted_returns