def testZipfLogPmf_NonIntegerArgs(self):
    batch_size = 12
    power = tf.constant(([3.0] * batch_size))
    power_v = 3.0
    x = [(- 3.0), (- 0.5), 0.0, 2.0, 2.2, 3.0, 3.1, 4.0, 5.0, 5.5, 6.0, 7.2]
    zipf = tfd.Zipf(power=power)
    log_pmf = zipf.log_prob(x)
    self.assertEqual((batch_size,), log_pmf.shape)
    log_pmf_values = self.evaluate(log_pmf)
    floor_x = np.floor(x)
    ceil_x = np.ceil(x)
    self.assertAllBetween(log_pmf_values, stats.zipf.logpmf(ceil_x, power_v), stats.zipf.logpmf(floor_x, power_v))
    pmf = zipf.prob(x)
    self.assertEqual((batch_size,), pmf.shape)
    pmf_values = self.evaluate(pmf)
    self.assertAllBetween(pmf_values, stats.zipf.pmf(ceil_x, power_v), stats.zipf.pmf(floor_x, power_v))
def testZipfLogPmf_NonIntegerArgs(self):
    batch_size = 12
    power = tf.constant(([3.0] * batch_size))
    power_v = 3.0
    x = [(- 3.0), (- 0.5), 0.0, 2.0, 2.2, 3.0, 3.1, 4.0, 5.0, 5.5, 6.0, 7.2]
    zipf = tfd.Zipf(power=power)
    log_pmf = zipf.log_prob(x)
    self.assertEqual((batch_size,), log_pmf.shape)
    log_pmf_values = self.evaluate(log_pmf)
    floor_x = np.floor(x)
    ceil_x = np.ceil(x)
    self.assertAllBetween(log_pmf_values, stats.zipf.logpmf(ceil_x, power_v), stats.zipf.logpmf(floor_x, power_v))
    pmf = zipf.prob(x)
    self.assertEqual((batch_size,), pmf.shape)
    pmf_values = self.evaluate(pmf)
    self.assertAllBetween(pmf_values, stats.zipf.pmf(ceil_x, power_v), stats.zipf.pmf(floor_x, power_v))