def testDpgGradientClipping(self):
    """Tests the gradient qd/qa are clipped."""
    _, dpg_extra = dpg_ops.dpg(
        self.q_tm1_max, self.a_tm1_max, dqda_clipping=0.01)
    with self.test_session() as sess:
      sess.run(tf.global_variables_initializer())
      value_grad = np.transpose(self.w.eval())[0]
      for i in range(int(self.batch_size)):
        self.assertAllClose(dpg_extra.dqda.eval()[i],
                            np.clip(value_grad, -0.01, 0.01))
        self.assertTrue(np.greater(np.absolute(value_grad), 0.01).any())
Tests the gradient qd/qa are clipped.
trfl/dpg_ops_test.py