import tensorflow as tf


  def testParetoPDFGradientZeroOutsideSupport(self):
    scale = tf.constant(1.)
    concentration = tf.constant(3.)
    # Check the gradient on the undefined portion.
    x = scale - 1

    pareto = tfd.Pareto(concentration, scale)
    compute_pdf = lambda x: pareto.prob(x)  # pylint:disable=unnecessary-lambda
    self.assertAlmostEqual(self.compute_gradients(
        compute_pdf, args=[x])[0], 0.)

  def testParetoCDFGradientZeroOutsideSupport(self):
    scale = tf.constant(1.)
    concentration = tf.constant(3.)
    # Check the gradient on the undefined portion.
    x = scale - 1

    pareto = tfd.Pareto(concentration, scale)
    compute_cdf = lambda x: pareto.cdf(x)  # pylint:disable=unnecessary-lambda
    self.assertAlmostEqual(
        self.compute_gradients(
            compute_cdf, args=[x])[0], 0.)

  def testParetoMean(self):
    scale = [1.4, 2., 2.5]
    concentration = [2., 3., 2.5]
    pareto = tfd.Pareto(concentration, scale)
