def testZipfSampleMultidimensionalMean(self):
    power_v = np.array([np.arange(5, 15, dtype=np.float32)])
    zipf = tfd.Zipf(power=power_v)
    n = int(100000.0)
    samples = zipf.sample(n, seed=tfp_test_util.test_seed())
    sample_values = self.evaluate(samples)
    self.assertEqual((n, 1, 10), samples.shape)
    self.assertEqual((n, 1, 10), sample_values.shape)
    stats_mean = np.vectorize(stats.zipf.mean)(power_v.astype(np.float64))
    self.assertAllClose(sample_values.mean(axis=0), stats_mean, rtol=0.01)
def testZipfSampleMultidimensionalMean(self):
    power_v = np.array([np.arange(5, 15, dtype=np.float32)])
    zipf = tfd.Zipf(power=power_v)
    n = int(100000.0)
    samples = zipf.sample(n, seed=tfp_test_util.test_seed())
    sample_values = self.evaluate(samples)
    self.assertEqual((n, 1, 10), samples.shape)
    self.assertEqual((n, 1, 10), sample_values.shape)
    stats_mean = np.vectorize(stats.zipf.mean)(power_v.astype(np.float64))
    self.assertAllClose(sample_values.mean(axis=0), stats_mean, rtol=0.01)