code: def testPolicyGradients(self, is_multi_actions):
      if is_multi_actions:
          loss = self.multi_op.extra.policy_gradient_loss
          policy_logits_nest = self.multi_policy_logits
      else:
          loss = self.op.extra.policy_gradient_loss
          policy_logits_nest = self.policy_logits
  
      grad_policy_list = [
          tf.gradients(loss, policy_logits)[0] * self.num_actions
          for policy_logits in nest.flatten(policy_logits_nest)
      ]
  
      for grad_policy in grad_policy_list:
          self.assertEqual(
              grad_policy.get_shape(), tf.TensorShape([2, 1, 3])
          )
  
      self.assertAllEqual(
          tf.gradients(loss, self.baseline_values), [None]
      )
      self.assertAllEqual(
          tf.gradients(loss, self.invalid_grad_inputs),
          self.invalid_grad_outputs,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  from six.moves import xrange
  import tensorflow.compat.v1
  import tree
  from trfl import discrete_policy_gradient_ops
label_desc: Use image node_id 2 for calling the SequenceAdvantageActorCriticLossGradientTest obj's underlying member method code with example usage: obj.testPolicyGradients(is_multi_actions) without return types