def testZipfLogPmfMultidimensional_NonIntegerArgs(self):
    batch_size = 6
    power = tf.constant(([[2.0, 4.0, 5.0]] * batch_size))
    power_v = [2.0, 4.0, 5.0]
    x = np.array([[2.0, 3.2, 4.3, 5.5, 6.9, 7.0]], dtype=np.float32).T
    floor_x = np.floor(x)
    ceil_x = np.ceil(x)
    zipf = tfd.Zipf(power=power)
    log_pmf = zipf.log_prob(x)
    self.assertEqual((6, 3), log_pmf.shape)
    self.assertAllBetween(self.evaluate(log_pmf), stats.zipf.logpmf(ceil_x, power_v), stats.zipf.logpmf(floor_x, power_v))
    pmf = zipf.prob(x)
    self.assertEqual((6, 3), pmf.shape)
    self.assertAllBetween(self.evaluate(pmf), stats.zipf.pmf(ceil_x, power_v), stats.zipf.pmf(floor_x, power_v))
def testZipfLogPmfMultidimensional_NonIntegerArgs(self):
    batch_size = 6
    power = tf.constant(([[2.0, 4.0, 5.0]] * batch_size))
    power_v = [2.0, 4.0, 5.0]
    x = np.array([[2.0, 3.2, 4.3, 5.5, 6.9, 7.0]], dtype=np.float32).T
    floor_x = np.floor(x)
    ceil_x = np.ceil(x)
    zipf = tfd.Zipf(power=power)
    log_pmf = zipf.log_prob(x)
    self.assertEqual((6, 3), log_pmf.shape)
    self.assertAllBetween(self.evaluate(log_pmf), stats.zipf.logpmf(ceil_x, power_v), stats.zipf.logpmf(floor_x, power_v))
    pmf = zipf.prob(x)
    self.assertEqual((6, 3), pmf.shape)
    self.assertAllBetween(self.evaluate(pmf), stats.zipf.pmf(ceil_x, power_v), stats.zipf.pmf(floor_x, power_v))