class_docstr: Test class for tf utility functions.
docstr: Tests compute_advantages function in utils.
code: def test_compute_advantages(self):
      """Tests compute_advantages function in utils."""
      discount = 1
      gae_lambda = 1
      max_len = 1
      rewards = tf.compat.v1.placeholder(
          dtype=tf.float32, name="reward", shape=[None, None]
      )
      baselines = tf.compat.v1.placeholder(
          dtype=tf.float32, name="baseline", shape=[None, None]
      )
      adv = compute_advantages(
          discount, gae_lambda, max_len, baselines, rewards
      )
  
      # Set up inputs and outputs
      rewards_val = np.ones(shape=[2, 1])
      baselines_val = np.zeros(shape=[2, 1])
      desired_val = np.array([1.0, 1.0])
  
      adv = self.sess.run(
          adv,
          feed_dict={
              rewards: rewards_val,
              baselines: baselines_val,
          },
      )
  
      assert np.array_equal(adv, desired_val)
  
file_path: garage/tests/garage/tf/test_functions.py
imports: import numpy
  import tensorflow
  from garage.tf import compute_advantages, get_target_ops
  from tests.fixtures import TfGraphTestCase
label_desc: Use image node_id 1 for calling the TestTensorUtil obj's underlying member method code with example usage: obj.test_compute_advantages() without return types