aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Joshua V. Dillon <jvdillon@google.com>2016-11-09 12:24:31 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-11-09 12:44:34 -0800
commit56b09d13c8f93935f18123efebbaceabae9b457c (patch)
treef59d74947d582a969efffbf720f0c0ce05b100d0
parent641894039e740840816575103dc816541381da59 (diff)
s/sample_n/sample/ in most unittests.
Change: 138670422
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/bernoulli_test.py18
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/beta_test.py8
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/categorical_test.py6
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/dirichlet_test.py2
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/exponential_test.py4
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/gamma_test.py8
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/inverse_gamma_test.py6
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/laplace_test.py6
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/mvn_test.py10
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/normal_test.py4
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/student_t_test.py16
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/transformed_distribution_test.py6
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/uniform_test.py6
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/wishart_test.py18
14 files changed, 59 insertions, 59 deletions
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/bernoulli_test.py b/tensorflow/contrib/distributions/python/kernel_tests/bernoulli_test.py
index 40cd863700..a3bc82d8a7 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/bernoulli_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/bernoulli_test.py
@@ -89,7 +89,7 @@ class BernoulliTest(tf.test.TestCase):
def testDtype(self):
dist = make_bernoulli([])
self.assertEqual(dist.dtype, tf.int32)
- self.assertEqual(dist.dtype, dist.sample_n(5).dtype)
+ self.assertEqual(dist.dtype, dist.sample(5).dtype)
self.assertEqual(dist.dtype, dist.mode().dtype)
self.assertEqual(dist.p.dtype, dist.mean().dtype)
self.assertEqual(dist.p.dtype, dist.variance().dtype)
@@ -100,7 +100,7 @@ class BernoulliTest(tf.test.TestCase):
dist64 = make_bernoulli([], tf.int64)
self.assertEqual(dist64.dtype, tf.int64)
- self.assertEqual(dist64.dtype, dist64.sample_n(5).dtype)
+ self.assertEqual(dist64.dtype, dist64.sample(5).dtype)
self.assertEqual(dist64.dtype, dist64.mode().dtype)
def _testPmf(self, **kwargs):
@@ -186,7 +186,7 @@ class BernoulliTest(tf.test.TestCase):
p = [0.2, 0.6]
dist = tf.contrib.distributions.Bernoulli(p=p)
n = 100000
- samples = dist.sample_n(n)
+ samples = dist.sample(n)
samples.set_shape([n, 2])
self.assertEqual(samples.dtype, tf.int32)
sample_values = samples.eval()
@@ -201,7 +201,7 @@ class BernoulliTest(tf.test.TestCase):
# owing to mismatched types. b/30940152
dist = tf.contrib.distributions.Bernoulli(np.log([.2, .4]))
self.assertAllEqual(
- (1, 2), dist.sample_n(1, seed=42).get_shape().as_list())
+ (1, 2), dist.sample(1, seed=42).get_shape().as_list())
def testSampleActsLikeSampleN(self):
with self.test_session() as sess:
@@ -210,12 +210,12 @@ class BernoulliTest(tf.test.TestCase):
n = 1000
seed = 42
self.assertAllEqual(dist.sample(n, seed).eval(),
- dist.sample_n(n, seed).eval())
+ dist.sample(n, seed).eval())
n = tf.placeholder(tf.int32)
- sample, sample_n = sess.run([dist.sample(n, seed),
- dist.sample_n(n, seed)],
- feed_dict={n: 1000})
- self.assertAllEqual(sample, sample_n)
+ sample, sample = sess.run([dist.sample(n, seed),
+ dist.sample(n, seed)],
+ feed_dict={n: 1000})
+ self.assertAllEqual(sample, sample)
def testMean(self):
with self.test_session():
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/beta_test.py b/tensorflow/contrib/distributions/python/kernel_tests/beta_test.py
index c0eee548ff..226e1f2678 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/beta_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/beta_test.py
@@ -228,7 +228,7 @@ class BetaTest(tf.test.TestCase):
b = 2.
beta = tf.contrib.distributions.Beta(a, b)
n = tf.constant(100000)
- samples = beta.sample_n(n)
+ samples = beta.sample(n)
sample_values = samples.eval()
self.assertEqual(sample_values.shape, (100000,))
self.assertFalse(np.any(sample_values < 0.0))
@@ -254,11 +254,11 @@ class BetaTest(tf.test.TestCase):
tf.set_random_seed(654321)
beta1 = tf.contrib.distributions.Beta(a=a_val, b=b_val, name="beta1")
- samples1 = beta1.sample_n(n_val, seed=123456).eval()
+ samples1 = beta1.sample(n_val, seed=123456).eval()
tf.set_random_seed(654321)
beta2 = tf.contrib.distributions.Beta(a=a_val, b=b_val, name="beta2")
- samples2 = beta2.sample_n(n_val, seed=123456).eval()
+ samples2 = beta2.sample(n_val, seed=123456).eval()
self.assertAllClose(samples1, samples2)
@@ -268,7 +268,7 @@ class BetaTest(tf.test.TestCase):
b = np.random.rand(3, 2, 2).astype(np.float32)
beta = tf.contrib.distributions.Beta(a, b)
n = tf.constant(100000)
- samples = beta.sample_n(n)
+ samples = beta.sample(n)
sample_values = samples.eval()
self.assertEqual(sample_values.shape, (100000, 3, 2, 2))
self.assertFalse(np.any(sample_values < 0.0))
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/categorical_test.py b/tensorflow/contrib/distributions/python/kernel_tests/categorical_test.py
index ee9c1b5401..541487312a 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/categorical_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/categorical_test.py
@@ -73,11 +73,11 @@ class CategoricalTest(tf.test.TestCase):
def testDtype(self):
dist = make_categorical([], 5, dtype=tf.int32)
self.assertEqual(dist.dtype, tf.int32)
- self.assertEqual(dist.dtype, dist.sample_n(5).dtype)
+ self.assertEqual(dist.dtype, dist.sample(5).dtype)
self.assertEqual(dist.dtype, dist.mode().dtype)
dist = make_categorical([], 5, dtype=tf.int64)
self.assertEqual(dist.dtype, tf.int64)
- self.assertEqual(dist.dtype, dist.sample_n(5).dtype)
+ self.assertEqual(dist.dtype, dist.sample(5).dtype)
self.assertEqual(dist.dtype, dist.mode().dtype)
self.assertEqual(dist.p.dtype, tf.float32)
self.assertEqual(dist.logits.dtype, tf.float32)
@@ -140,7 +140,7 @@ class CategoricalTest(tf.test.TestCase):
histograms = [[[0.2, 0.8], [0.4, 0.6]]]
dist = tf.contrib.distributions.Categorical(tf.log(histograms) - 50.)
n = 10000
- samples = dist.sample_n(n, seed=123)
+ samples = dist.sample(n, seed=123)
samples.set_shape([n, 1, 2])
self.assertEqual(samples.dtype, tf.int32)
sample_values = samples.eval()
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/dirichlet_test.py b/tensorflow/contrib/distributions/python/kernel_tests/dirichlet_test.py
index 59a6216baa..9f6a33068d 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/dirichlet_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/dirichlet_test.py
@@ -182,7 +182,7 @@ class DirichletTest(tf.test.TestCase):
alpha = [1., 2]
dirichlet = tf.contrib.distributions.Dirichlet(alpha)
n = tf.constant(100000)
- samples = dirichlet.sample_n(n)
+ samples = dirichlet.sample(n)
sample_values = samples.eval()
self.assertEqual(sample_values.shape, (100000, 2))
self.assertTrue(np.all(sample_values > 0.0))
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/exponential_test.py b/tensorflow/contrib/distributions/python/kernel_tests/exponential_test.py
index 87885d79c8..b925a8e4f5 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/exponential_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/exponential_test.py
@@ -87,7 +87,7 @@ class ExponentialTest(tf.test.TestCase):
n = tf.constant(100000)
exponential = tf.contrib.distributions.Exponential(lam=lam)
- samples = exponential.sample_n(n, seed=137)
+ samples = exponential.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(sample_values.shape, (100000, 2))
self.assertFalse(np.any(sample_values < 0.0))
@@ -106,7 +106,7 @@ class ExponentialTest(tf.test.TestCase):
exponential = tf.contrib.distributions.Exponential(lam=lam)
n = 100000
- samples = exponential.sample_n(n, seed=138)
+ samples = exponential.sample(n, seed=138)
self.assertEqual(samples.get_shape(), (n, batch_size, 2))
sample_values = samples.eval()
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/gamma_test.py b/tensorflow/contrib/distributions/python/kernel_tests/gamma_test.py
index e32114992c..63f2660728 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/gamma_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/gamma_test.py
@@ -185,7 +185,7 @@ class GammaTest(tf.test.TestCase):
beta = tf.constant(beta_v)
n = 100000
gamma = tf.contrib.distributions.Gamma(alpha=alpha, beta=beta)
- samples = gamma.sample_n(n, seed=137)
+ samples = gamma.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(samples.get_shape(), (n,))
self.assertEqual(sample_values.shape, (n,))
@@ -208,7 +208,7 @@ class GammaTest(tf.test.TestCase):
beta = tf.constant(beta_v)
n = 100000
gamma = tf.contrib.distributions.Gamma(alpha=alpha, beta=beta)
- samples = gamma.sample_n(n, seed=137)
+ samples = gamma.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(samples.get_shape(), (n,))
self.assertEqual(sample_values.shape, (n,))
@@ -228,7 +228,7 @@ class GammaTest(tf.test.TestCase):
beta_v = np.array([np.arange(1, 11, dtype=np.float32)]).T # 10 x 1
gamma = tf.contrib.distributions.Gamma(alpha=alpha_v, beta=beta_v)
n = 10000
- samples = gamma.sample_n(n, seed=137)
+ samples = gamma.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(samples.get_shape(), (n, 10, 100))
self.assertEqual(sample_values.shape, (n, 10, 100))
@@ -263,7 +263,7 @@ class GammaTest(tf.test.TestCase):
with tf.Session() as sess:
gamma = tf.contrib.distributions.Gamma(alpha=[7., 11.], beta=[[5.], [6.]])
num = 50000
- samples = gamma.sample_n(num, seed=137)
+ samples = gamma.sample(num, seed=137)
pdfs = gamma.pdf(samples)
sample_vals, pdf_vals = sess.run([samples, pdfs])
self.assertEqual(samples.get_shape(), (num, 2, 2))
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/inverse_gamma_test.py b/tensorflow/contrib/distributions/python/kernel_tests/inverse_gamma_test.py
index 34e718eec8..d2fb30e2ea 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/inverse_gamma_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/inverse_gamma_test.py
@@ -203,7 +203,7 @@ class InverseGammaTest(tf.test.TestCase):
beta = tf.constant(beta_v)
n = 100000
inv_gamma = tf.contrib.distributions.InverseGamma(alpha=alpha, beta=beta)
- samples = inv_gamma.sample_n(n, seed=137)
+ samples = inv_gamma.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(samples.get_shape(), (n,))
self.assertEqual(sample_values.shape, (n,))
@@ -222,7 +222,7 @@ class InverseGammaTest(tf.test.TestCase):
inv_gamma = tf.contrib.distributions.InverseGamma(alpha=alpha_v,
beta=beta_v)
n = 10000
- samples = inv_gamma.sample_n(n, seed=137)
+ samples = inv_gamma.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(samples.get_shape(), (n, 10, 100))
self.assertEqual(sample_values.shape, (n, 10, 100))
@@ -257,7 +257,7 @@ class InverseGammaTest(tf.test.TestCase):
inv_gamma = tf.contrib.distributions.InverseGamma(alpha=[7., 11.],
beta=[[5.], [6.]])
num = 50000
- samples = inv_gamma.sample_n(num, seed=137)
+ samples = inv_gamma.sample(num, seed=137)
pdfs = inv_gamma.pdf(samples)
sample_vals, pdf_vals = sess.run([samples, pdfs])
self.assertEqual(samples.get_shape(), (num, 2, 2))
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/laplace_test.py b/tensorflow/contrib/distributions/python/kernel_tests/laplace_test.py
index 7649095262..32a3ce4afe 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/laplace_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/laplace_test.py
@@ -161,7 +161,7 @@ class LaplaceTest(tf.test.TestCase):
scale = tf.constant(scale_v)
n = 100000
laplace = tf.contrib.distributions.Laplace(loc=loc, scale=scale)
- samples = laplace.sample_n(n, seed=137)
+ samples = laplace.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(samples.get_shape(), (n,))
self.assertEqual(sample_values.shape, (n,))
@@ -179,7 +179,7 @@ class LaplaceTest(tf.test.TestCase):
scale_v = np.array([np.arange(1, 11, dtype=np.float32)]).T # 10 x 1
laplace = tf.contrib.distributions.Laplace(loc=loc_v, scale=scale_v)
n = 10000
- samples = laplace.sample_n(n, seed=137)
+ samples = laplace.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(samples.get_shape(), (n, 10, 100))
self.assertEqual(sample_values.shape, (n, 10, 100))
@@ -214,7 +214,7 @@ class LaplaceTest(tf.test.TestCase):
laplace = tf.contrib.distributions.Laplace(
loc=[7., 11.], scale=[[5.], [6.]])
num = 50000
- samples = laplace.sample_n(num, seed=137)
+ samples = laplace.sample(num, seed=137)
pdfs = laplace.pdf(samples)
sample_vals, pdf_vals = sess.run([samples, pdfs])
self.assertEqual(samples.get_shape(), (num, 2, 2))
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/mvn_test.py b/tensorflow/contrib/distributions/python/kernel_tests/mvn_test.py
index 2b56f0864e..791ff3e03a 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/mvn_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/mvn_test.py
@@ -111,7 +111,7 @@ class MultivariateNormalDiagTest(tf.test.TestCase):
diag = [1.0, 2.0]
with self.test_session():
dist = distributions.MultivariateNormalDiag(mu, diag)
- samps = dist.sample_n(1000, seed=0).eval()
+ samps = dist.sample(1000, seed=0).eval()
cov_mat = tf.matrix_diag(diag).eval()**2
self.assertAllClose(mu, samps.mean(axis=0), atol=0.1)
@@ -122,7 +122,7 @@ class MultivariateNormalDiagTest(tf.test.TestCase):
diag = [-1.0, -2.0]
with self.test_session():
dist = distributions.MultivariateNormalDiagWithSoftplusStDev(mu, diag)
- samps = dist.sample_n(1000, seed=0).eval()
+ samps = dist.sample(1000, seed=0).eval()
cov_mat = tf.matrix_diag(tf.nn.softplus(diag)).eval()**2
self.assertAllClose(mu, samps.mean(axis=0), atol=0.1)
@@ -177,7 +177,7 @@ class MultivariateNormalDiagPlusVDVTTest(tf.test.TestCase):
with self.test_session():
dist = distributions.MultivariateNormalDiagPlusVDVT(mu, diag_large, v)
- samps = dist.sample_n(1000, seed=0).eval()
+ samps = dist.sample(1000, seed=0).eval()
cov_mat = dist.sigma.eval()
self.assertAllClose(mu, samps.mean(axis=0), atol=0.1)
@@ -318,7 +318,7 @@ class MultivariateNormalCholeskyTest(tf.test.TestCase):
n = tf.constant(100000)
mvn = distributions.MultivariateNormalCholesky(mu, chol)
- samples = mvn.sample_n(n, seed=137)
+ samples = mvn.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(samples.get_shape(), (100000, 2))
self.assertAllClose(sample_values.mean(axis=0), mu, atol=1e-2)
@@ -355,7 +355,7 @@ class MultivariateNormalCholeskyTest(tf.test.TestCase):
mvn = distributions.MultivariateNormalCholesky(mu, chol)
n = tf.constant(100000)
- samples = mvn.sample_n(n, seed=137)
+ samples = mvn.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(samples.get_shape(), (100000, 3, 5, 2))
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/normal_test.py b/tensorflow/contrib/distributions/python/kernel_tests/normal_test.py
index 7ff15aa8bb..e22cd361cb 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/normal_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/normal_test.py
@@ -290,7 +290,7 @@ class NormalTest(tf.test.TestCase):
sigma_v = np.sqrt(3.0)
n = tf.constant(100000)
normal = tf.contrib.distributions.Normal(mu=mu, sigma=sigma)
- samples = normal.sample_n(n)
+ samples = normal.sample(n)
sample_values = samples.eval()
# Note that the standard error for the sample mean is ~ sigma / sqrt(n).
# The sample variance similarly is dependent on sigma and n.
@@ -323,7 +323,7 @@ class NormalTest(tf.test.TestCase):
sigma_v = [np.sqrt(2.0), np.sqrt(3.0)]
n = tf.constant(100000)
normal = tf.contrib.distributions.Normal(mu=mu, sigma=sigma)
- samples = normal.sample_n(n)
+ samples = normal.sample(n)
sample_values = samples.eval()
# Note that the standard error for the sample mean is ~ sigma / sqrt(n).
# The sample variance similarly is dependent on sigma and n.
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/student_t_test.py b/tensorflow/contrib/distributions/python/kernel_tests/student_t_test.py
index c78ca2d643..e8c8601b92 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/student_t_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/student_t_test.py
@@ -110,7 +110,7 @@ class StudentTTest(tf.test.TestCase):
sigma_v = np.sqrt(10.0)
n = tf.constant(200000)
student = tf.contrib.distributions.StudentT(df=df, mu=mu, sigma=sigma)
- samples = student.sample_n(n)
+ samples = student.sample(n)
sample_values = samples.eval()
n_val = 200000
self.assertEqual(sample_values.shape, (n_val,))
@@ -134,12 +134,12 @@ class StudentTTest(tf.test.TestCase):
tf.set_random_seed(654321)
student = tf.contrib.distributions.StudentT(
df=df, mu=mu, sigma=sigma, name="student_t1")
- samples1 = student.sample_n(n, seed=123456).eval()
+ samples1 = student.sample(n, seed=123456).eval()
tf.set_random_seed(654321)
student2 = tf.contrib.distributions.StudentT(
df=df, mu=mu, sigma=sigma, name="student_t2")
- samples2 = student2.sample_n(n, seed=123456).eval()
+ samples2 = student2.sample(n, seed=123456).eval()
self.assertAllClose(samples1, samples2)
@@ -149,7 +149,7 @@ class StudentTTest(tf.test.TestCase):
df = tf.constant(df_v)
n = tf.constant(200000)
student = tf.contrib.distributions.StudentT(df=df, mu=1.0, sigma=1.0)
- samples = student.sample_n(n)
+ samples = student.sample(n)
sample_values = samples.eval()
n_val = 200000
self.assertEqual(sample_values.shape, (n_val, 4))
@@ -166,7 +166,7 @@ class StudentTTest(tf.test.TestCase):
sigma_v = [np.sqrt(10.0), np.sqrt(15.0)]
n = tf.constant(200000)
student = tf.contrib.distributions.StudentT(df=df, mu=mu, sigma=sigma)
- samples = student.sample_n(n)
+ samples = student.sample(n)
sample_values = samples.eval()
self.assertEqual(samples.get_shape(), (200000, batch_size, 2))
self.assertAllClose(
@@ -208,7 +208,7 @@ class StudentTTest(tf.test.TestCase):
self.assertEqual(student.entropy().get_shape(), (3,))
self.assertEqual(student.log_pdf(2.).get_shape(), (3,))
self.assertEqual(student.pdf(2.).get_shape(), (3,))
- self.assertEqual(student.sample_n(37).get_shape(), (37, 3,))
+ self.assertEqual(student.sample(37).get_shape(), (37, 3,))
_check(tf.contrib.distributions.StudentT(df=[2., 3., 4.,], mu=2., sigma=1.))
_check(tf.contrib.distributions.StudentT(df=7., mu=[2., 3., 4.,], sigma=1.))
@@ -377,7 +377,7 @@ class StudentTTest(tf.test.TestCase):
with self.test_session() as sess:
student = tf.contrib.distributions.StudentT(df=3., mu=np.pi, sigma=1.)
num = 20000
- samples = student.sample_n(num)
+ samples = student.sample(num)
pdfs = student.pdf(samples)
mean = student.mean()
mean_pdf = student.pdf(student.mean())
@@ -398,7 +398,7 @@ class StudentTTest(tf.test.TestCase):
mu=[[5.], [6.]],
sigma=3.)
num = 50000
- samples = student.sample_n(num)
+ samples = student.sample(num)
pdfs = student.pdf(samples)
sample_vals, pdf_vals = sess.run([samples, pdfs])
self.assertEqual(samples.get_shape(), (num, 2, 2))
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/transformed_distribution_test.py b/tensorflow/contrib/distributions/python/kernel_tests/transformed_distribution_test.py
index 84dfdee67b..a71ce792ea 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/transformed_distribution_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/transformed_distribution_test.py
@@ -70,7 +70,7 @@ class TransformedDistributionTest(tf.test.TestCase):
sp_dist = stats.lognorm(s=sigma, scale=np.exp(mu))
# sample
- sample = log_normal.sample_n(100000, seed=235)
+ sample = log_normal.sample(100000, seed=235)
with self.test_session(graph=g):
self.assertAllClose(sp_dist.mean(), np.mean(sample.eval()),
atol=0.0, rtol=0.05)
@@ -98,7 +98,7 @@ class TransformedDistributionTest(tf.test.TestCase):
distribution=distributions.Normal(mu=mu, sigma=sigma),
bijector=bijectors.Exp(event_ndims=0))
- sample = log_normal.sample_n(1)
+ sample = log_normal.sample(1)
sample_val, log_pdf_val = sess.run([sample, log_normal.log_pdf(sample)])
self.assertAllClose(
stats.lognorm.logpdf(sample_val, s=sigma,
@@ -113,7 +113,7 @@ class TransformedDistributionTest(tf.test.TestCase):
bijector=_ChooseLocation(loc=[-100., 100.]))
z = [-1, +1, -1, -1, +1]
self.assertAllClose(
- np.sign(conditional_normal.sample_n(
+ np.sign(conditional_normal.sample(
5, bijector_kwargs={"z": z}).eval()), z)
def testShapeChangingBijector(self):
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/uniform_test.py b/tensorflow/contrib/distributions/python/kernel_tests/uniform_test.py
index a589e1f1cb..c2ab584b63 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/uniform_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/uniform_test.py
@@ -135,7 +135,7 @@ class UniformTest(tf.test.TestCase):
n = tf.constant(100000)
uniform = tf.contrib.distributions.Uniform(a=a, b=b)
- samples = uniform.sample_n(n, seed=137)
+ samples = uniform.sample(n, seed=137)
sample_values = samples.eval()
self.assertEqual(sample_values.shape, (100000, 2))
self.assertAllClose(sample_values[::, 0].mean(), (b_v + a1_v) / 2,
@@ -160,7 +160,7 @@ class UniformTest(tf.test.TestCase):
n_v = 100000
n = tf.constant(n_v)
- samples = uniform.sample_n(n)
+ samples = uniform.sample(n)
self.assertEqual(samples.get_shape(), (n_v, batch_size, 2))
sample_values = samples.eval()
@@ -221,7 +221,7 @@ class UniformTest(tf.test.TestCase):
a = 10.0
b = [11.0, 100.0]
uniform = tf.contrib.distributions.Uniform(a, b)
- self.assertTrue(tf.reduce_all(uniform.pdf(uniform.sample_n(10)) > 0).eval(
+ self.assertTrue(tf.reduce_all(uniform.pdf(uniform.sample(10)) > 0).eval(
))
def testUniformBroadcasting(self):
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/wishart_test.py b/tensorflow/contrib/distributions/python/kernel_tests/wishart_test.py
index 8a0cf5ae1d..cf663ffc6d 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/wishart_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/wishart_test.py
@@ -106,23 +106,23 @@ class WishartCholeskyTest(tf.test.TestCase):
chol_w = distributions.WishartCholesky(
df, chol(scale), cholesky_input_output_matrices=False)
- x = chol_w.sample_n(1, seed=42).eval()
+ x = chol_w.sample(1, seed=42).eval()
chol_x = [chol(x[0])]
full_w = distributions.WishartFull(
df, scale, cholesky_input_output_matrices=False)
- self.assertAllClose(x, full_w.sample_n(1, seed=42).eval())
+ self.assertAllClose(x, full_w.sample(1, seed=42).eval())
chol_w_chol = distributions.WishartCholesky(
df, chol(scale), cholesky_input_output_matrices=True)
- self.assertAllClose(chol_x, chol_w_chol.sample_n(1, seed=42).eval())
- eigen_values = tf.matrix_diag_part(chol_w_chol.sample_n(1000, seed=42))
+ self.assertAllClose(chol_x, chol_w_chol.sample(1, seed=42).eval())
+ eigen_values = tf.matrix_diag_part(chol_w_chol.sample(1000, seed=42))
np.testing.assert_array_less(0., eigen_values.eval())
full_w_chol = distributions.WishartFull(
df, scale, cholesky_input_output_matrices=True)
- self.assertAllClose(chol_x, full_w_chol.sample_n(1, seed=42).eval())
- eigen_values = tf.matrix_diag_part(full_w_chol.sample_n(1000, seed=42))
+ self.assertAllClose(chol_x, full_w_chol.sample(1, seed=42).eval())
+ eigen_values = tf.matrix_diag_part(full_w_chol.sample(1000, seed=42))
np.testing.assert_array_less(0., eigen_values.eval())
# Check first and second moments.
@@ -131,7 +131,7 @@ class WishartCholeskyTest(tf.test.TestCase):
df=df,
scale=chol(make_pd(1., 3)),
cholesky_input_output_matrices=False)
- x = chol_w.sample_n(10000, seed=42)
+ x = chol_w.sample(10000, seed=42)
self.assertAllEqual((10000, 3, 3), x.get_shape())
moment1_estimate = tf.reduce_mean(x, reduction_indices=[0]).eval()
@@ -161,7 +161,7 @@ class WishartCholeskyTest(tf.test.TestCase):
scale=chol(make_pd(1., 3)),
cholesky_input_output_matrices=False,
name="wishart1")
- samples1 = chol_w1.sample_n(n_val, seed=123456).eval()
+ samples1 = chol_w1.sample(n_val, seed=123456).eval()
tf.set_random_seed(654321)
chol_w2 = distributions.WishartCholesky(
@@ -169,7 +169,7 @@ class WishartCholeskyTest(tf.test.TestCase):
scale=chol(make_pd(1., 3)),
cholesky_input_output_matrices=False,
name="wishart2")
- samples2 = chol_w2.sample_n(n_val, seed=123456).eval()
+ samples2 = chol_w2.sample(n_val, seed=123456).eval()
self.assertAllClose(samples1, samples2)