def testZipfLogPmf_IntegerArgs(self):
    batch_size = 9
    power = tf.constant(([3.0] * batch_size))
    power_v = 3.0
    x = np.array([(- 3.0), (- 0.0), 0.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0], dtype=np.float32)
    zipf = tfd.Zipf(power=power)
    log_pmf = zipf.log_prob(x)
    self.assertEqual((batch_size,), log_pmf.shape)
    self.assertAllClose(self.evaluate(log_pmf), stats.zipf.logpmf(x, power_v))
    pmf = zipf.prob(x)
    self.assertEqual((batch_size,), pmf.shape)
    self.assertAllClose(self.evaluate(pmf), stats.zipf.pmf(x, power_v))
def testZipfLogPmf_IntegerArgs(self):
    batch_size = 9
    power = tf.constant(([3.0] * batch_size))
    power_v = 3.0
    x = np.array([(- 3.0), (- 0.0), 0.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0], dtype=np.float32)
    zipf = tfd.Zipf(power=power)
    log_pmf = zipf.log_prob(x)
    self.assertEqual((batch_size,), log_pmf.shape)
    self.assertAllClose(self.evaluate(log_pmf), stats.zipf.logpmf(x, power_v))
    pmf = zipf.prob(x)
    self.assertEqual((batch_size,), pmf.shape)
    self.assertAllClose(self.evaluate(pmf), stats.zipf.pmf(x, power_v))