class_docstr: Tests for discrete_policy_gradient_loss op.
class_docstr_tok: ["Tests","for","discrete_policy_gradient_loss","op","."]
code: def testGradients(self, is_multi_actions):
      self._setUpLoss(is_multi_actions)
      with self.test_session() as sess:
          total_loss = tf.reduce_sum(self._loss)
          gradients = tf.gradients(
              [total_loss], nest.flatten(self._policy_logits_nest)
          )
          grad_policy_logits_nest = sess.run(gradients)
          for grad_policy_logits in grad_policy_logits_nest:
              self.assertAllClose(
                  grad_policy_logits,
                  [[[0, 0], [-0.731, 0.731]], [[1, -1], [0, 0]]],
                  atol=1e-4,
              )
          dead_grads = tf.gradients(
              [total_loss],
              nest.flatten(self._actions_nest) + [self._action_values],
          )
          for grad in dead_grads:
              self.assertIsNone(grad)
  
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 3 for calling the DiscretePolicyGradientLossTest obj's underlying member method code with example usage: obj.testGradients(is_multi_actions) without return types