def testZipfLogPmf_InvalidArgs(self):
    power = tf.constant([4.0])
    zipf = tfd.Zipf(power=power, interpolate_nondiscrete=False, validate_args=True)
    non_integer_samples = [0.99, 4.5, 5.001, 1e-05]
    for x in non_integer_samples:
        with self.assertRaisesOpError('cannot contain fractional components'):
            self.evaluate(zipf.log_prob(x))
        with self.assertRaisesOpError('cannot contain fractional components'):
            self.evaluate(zipf.prob(x))
    zipf = tfd.Zipf(power=power, validate_args=True)
    negative_samples = [(- 3), (- 2), (- 1)]
    for x in negative_samples:
        with self.assertRaisesOpError('must be non-negative'):
            self.evaluate(zipf.log_prob(x))
        with self.assertRaisesOpError('must be non-negative'):
            self.evaluate(zipf.prob(x))
def testZipfLogPmf_InvalidArgs(self):
    power = tf.constant([4.0])
    zipf = tfd.Zipf(power=power, interpolate_nondiscrete=False, validate_args=True)
    non_integer_samples = [0.99, 4.5, 5.001, 1e-05]
    for x in non_integer_samples:
        with self.assertRaisesOpError('cannot contain fractional components'):
            self.evaluate(zipf.log_prob(x))
        with self.assertRaisesOpError('cannot contain fractional components'):
            self.evaluate(zipf.prob(x))
    zipf = tfd.Zipf(power=power, validate_args=True)
    negative_samples = [(- 3), (- 2), (- 1)]
    for x in negative_samples:
        with self.assertRaisesOpError('must be non-negative'):
            self.evaluate(zipf.log_prob(x))
        with self.assertRaisesOpError('must be non-negative'):
            self.evaluate(zipf.prob(x))