aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/distributions
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-03-29 10:06:52 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-29 10:09:16 -0700
commit950b4e59f2dbd1836a17f3a3f83e4b829c10db77 (patch)
tree3c560b2f9cce76f9a2778f24336cd7a5d934ad38 /tensorflow/contrib/distributions
parent33603b1983e8497601d2a256d6347684cf7d0bdf (diff)
Automated g4 rollback of changelist 190728742
PiperOrigin-RevId: 190946066
Diffstat (limited to 'tensorflow/contrib/distributions')
-rw-r--r--tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py16
-rw-r--r--tensorflow/contrib/distributions/python/ops/autoregressive.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/binomial.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/cauchy.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/chi2.py4
-rw-r--r--tensorflow/contrib/distributions/python/ops/deterministic.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/geometric.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/gumbel.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/half_normal.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/independent.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/inverse_gamma.py4
-rw-r--r--tensorflow/contrib/distributions/python/ops/kumaraswamy.py9
-rw-r--r--tensorflow/contrib/distributions/python/ops/logistic.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/mixture.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/mixture_same_family.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/mvn_diag.py4
-rw-r--r--tensorflow/contrib/distributions/python/ops/mvn_diag_plus_low_rank.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/mvn_full_covariance.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/mvn_linear_operator.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/mvn_tril.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/negative_binomial.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/onehot_categorical.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/poisson.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/poisson_lognormal.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/quantized_distribution.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/relaxed_bernoulli.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/sinh_arcsinh.py3
-rw-r--r--tensorflow/contrib/distributions/python/ops/vector_diffeomixture.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/vector_exponential_diag.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/vector_exponential_linear_operator.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/vector_sinh_arcsinh_diag.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/vector_student_t.py2
-rw-r--r--tensorflow/contrib/distributions/python/ops/wishart.py10
34 files changed, 43 insertions, 61 deletions
diff --git a/tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py b/tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py
index 750fe00d63..68e0d9cb82 100644
--- a/tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py
+++ b/tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py
@@ -190,22 +190,6 @@ class DistributionTest(test.TestCase):
y = dist._set_sample_static_shape(x, sample_shape)
self.assertTrue(y.get_shape().ndims is None)
- def testNameScopeWorksCorrectly(self):
- x = tfd.Normal(loc=0., scale=1., name="x")
- x_duplicate = tfd.Normal(loc=0., scale=1., name="x")
- with ops.name_scope("y") as name:
- y = tfd.Bernoulli(logits=0., name=name)
- x_sample = x.sample(name="custom_sample")
- x_sample_duplicate = x.sample(name="custom_sample")
- x_log_prob = x.log_prob(0., name="custom_log_prob")
-
- self.assertEqual(x.name, "x")
- self.assertEqual(x_duplicate.name, "x_1")
- self.assertEqual(y.name, "y")
- self.assertTrue(x_sample.name.startswith("x/custom_sample"))
- self.assertTrue(x_sample_duplicate.name.startswith("x/custom_sample_1"))
- self.assertTrue(x_log_prob.name.startswith("x/custom_log_prob"))
-
def testStrWorksCorrectlyScalar(self):
normal = tfd.Normal(loc=np.float16(0), scale=np.float16(1))
self.assertEqual(
diff --git a/tensorflow/contrib/distributions/python/ops/autoregressive.py b/tensorflow/contrib/distributions/python/ops/autoregressive.py
index 88ed012784..69f3d57ff0 100644
--- a/tensorflow/contrib/distributions/python/ops/autoregressive.py
+++ b/tensorflow/contrib/distributions/python/ops/autoregressive.py
@@ -145,7 +145,7 @@ class Autoregressive(distribution_lib.Distribution):
ValueError: if `num_steps < 1`.
"""
parameters = locals()
- with ops.name_scope(name) as name:
+ with ops.name_scope(name):
self._distribution_fn = distribution_fn
self._sample0 = sample0
self._distribution0 = (distribution_fn() if sample0 is None
diff --git a/tensorflow/contrib/distributions/python/ops/binomial.py b/tensorflow/contrib/distributions/python/ops/binomial.py
index 12d1603178..6a1bb39ab2 100644
--- a/tensorflow/contrib/distributions/python/ops/binomial.py
+++ b/tensorflow/contrib/distributions/python/ops/binomial.py
@@ -164,7 +164,7 @@ class Binomial(distribution.Distribution):
name: Python `str` name prefixed to Ops created by this class.
"""
parameters = locals()
- with ops.name_scope(name, values=[total_count, logits, probs]) as name:
+ with ops.name_scope(name, values=[total_count, logits, probs]):
self._total_count = self._maybe_assert_valid_total_count(
ops.convert_to_tensor(total_count, name="total_count"),
validate_args)
diff --git a/tensorflow/contrib/distributions/python/ops/cauchy.py b/tensorflow/contrib/distributions/python/ops/cauchy.py
index daacfe657f..6f5d724a2a 100644
--- a/tensorflow/contrib/distributions/python/ops/cauchy.py
+++ b/tensorflow/contrib/distributions/python/ops/cauchy.py
@@ -121,7 +121,7 @@ class Cauchy(distribution.Distribution):
TypeError: if `loc` and `scale` have different `dtype`.
"""
parameters = locals()
- with ops.name_scope(name, values=[loc, scale]) as name:
+ with ops.name_scope(name, values=[loc, scale]):
with ops.control_dependencies([check_ops.assert_positive(scale)]
if validate_args else []):
self._loc = array_ops.identity(loc, name="loc")
diff --git a/tensorflow/contrib/distributions/python/ops/chi2.py b/tensorflow/contrib/distributions/python/ops/chi2.py
index c77c5fd208..e610f469e5 100644
--- a/tensorflow/contrib/distributions/python/ops/chi2.py
+++ b/tensorflow/contrib/distributions/python/ops/chi2.py
@@ -88,7 +88,7 @@ class Chi2(gamma.Gamma):
# not true in the parent class "gamma." therefore, passing
# allow_nan_stats=True
# through to the parent class results in unnecessary asserts.
- with ops.name_scope(name, values=[df]) as name:
+ with ops.name_scope(name, values=[df]):
with ops.control_dependencies([
check_ops.assert_positive(df),
] if validate_args else []):
@@ -120,7 +120,7 @@ class Chi2WithAbsDf(Chi2):
allow_nan_stats=True,
name="Chi2WithAbsDf"):
parameters = locals()
- with ops.name_scope(name, values=[df]) as name:
+ with ops.name_scope(name, values=[df]):
super(Chi2WithAbsDf, self).__init__(
df=math_ops.floor(
math_ops.abs(df, name="abs_df"),
diff --git a/tensorflow/contrib/distributions/python/ops/deterministic.py b/tensorflow/contrib/distributions/python/ops/deterministic.py
index a42350430e..8049522e9f 100644
--- a/tensorflow/contrib/distributions/python/ops/deterministic.py
+++ b/tensorflow/contrib/distributions/python/ops/deterministic.py
@@ -87,7 +87,7 @@ class _BaseDeterministic(distribution.Distribution):
ValueError: If `loc` is a scalar.
"""
parameters = locals()
- with ops.name_scope(name, values=[loc, atol, rtol]) as name:
+ with ops.name_scope(name, values=[loc, atol, rtol]):
loc = ops.convert_to_tensor(loc, name="loc")
if is_vector and validate_args:
msg = "Argument loc must be at least rank 1."
diff --git a/tensorflow/contrib/distributions/python/ops/geometric.py b/tensorflow/contrib/distributions/python/ops/geometric.py
index 53dd42f4c8..8f190e48a7 100644
--- a/tensorflow/contrib/distributions/python/ops/geometric.py
+++ b/tensorflow/contrib/distributions/python/ops/geometric.py
@@ -86,7 +86,7 @@ class Geometric(distribution.Distribution):
"""
parameters = locals()
- with ops.name_scope(name, values=[logits, probs]) as name:
+ with ops.name_scope(name, values=[logits, probs]):
self._logits, self._probs = distribution_util.get_logits_and_probs(
logits, probs, validate_args=validate_args, name=name)
diff --git a/tensorflow/contrib/distributions/python/ops/gumbel.py b/tensorflow/contrib/distributions/python/ops/gumbel.py
index 2c261073ee..8d05ad6b80 100644
--- a/tensorflow/contrib/distributions/python/ops/gumbel.py
+++ b/tensorflow/contrib/distributions/python/ops/gumbel.py
@@ -125,7 +125,7 @@ class _Gumbel(distribution.Distribution):
TypeError: if loc and scale are different dtypes.
"""
parameters = locals()
- with ops.name_scope(name, values=[loc, scale]) as name:
+ with ops.name_scope(name, values=[loc, scale]):
with ops.control_dependencies([check_ops.assert_positive(scale)] if
validate_args else []):
self._loc = array_ops.identity(loc, name="loc")
diff --git a/tensorflow/contrib/distributions/python/ops/half_normal.py b/tensorflow/contrib/distributions/python/ops/half_normal.py
index d0df2befd6..fc0751a6e0 100644
--- a/tensorflow/contrib/distributions/python/ops/half_normal.py
+++ b/tensorflow/contrib/distributions/python/ops/half_normal.py
@@ -106,7 +106,7 @@ class HalfNormal(distribution.Distribution):
name: Python `str` name prefixed to Ops created by this class.
"""
parameters = locals()
- with ops.name_scope(name, values=[scale]) as name:
+ with ops.name_scope(name, values=[scale]):
with ops.control_dependencies([check_ops.assert_positive(scale)] if
validate_args else []):
self._scale = array_ops.identity(scale, name="scale")
diff --git a/tensorflow/contrib/distributions/python/ops/independent.py b/tensorflow/contrib/distributions/python/ops/independent.py
index d7d0b0c78b..7dcb3e3ac4 100644
--- a/tensorflow/contrib/distributions/python/ops/independent.py
+++ b/tensorflow/contrib/distributions/python/ops/independent.py
@@ -119,7 +119,7 @@ class Independent(distribution_lib.Distribution):
parameters = locals()
name = name or "Independent" + distribution.name
self._distribution = distribution
- with ops.name_scope(name) as name:
+ with ops.name_scope(name):
if reinterpreted_batch_ndims is None:
reinterpreted_batch_ndims = self._get_default_reinterpreted_batch_ndims(
distribution)
diff --git a/tensorflow/contrib/distributions/python/ops/inverse_gamma.py b/tensorflow/contrib/distributions/python/ops/inverse_gamma.py
index 502bd4f493..51ac61dcf6 100644
--- a/tensorflow/contrib/distributions/python/ops/inverse_gamma.py
+++ b/tensorflow/contrib/distributions/python/ops/inverse_gamma.py
@@ -126,7 +126,7 @@ class InverseGamma(distribution.Distribution):
TypeError: if `concentration` and `rate` are different dtypes.
"""
parameters = locals()
- with ops.name_scope(name, values=[concentration, rate]) as name:
+ with ops.name_scope(name, values=[concentration, rate]):
with ops.control_dependencies([
check_ops.assert_positive(concentration),
check_ops.assert_positive(rate),
@@ -281,7 +281,7 @@ class InverseGammaWithSoftplusConcentrationRate(InverseGamma):
allow_nan_stats=True,
name="InverseGammaWithSoftplusConcentrationRate"):
parameters = locals()
- with ops.name_scope(name, values=[concentration, rate]) as name:
+ with ops.name_scope(name, values=[concentration, rate]):
super(InverseGammaWithSoftplusConcentrationRate, self).__init__(
concentration=nn.softplus(concentration,
name="softplus_concentration"),
diff --git a/tensorflow/contrib/distributions/python/ops/kumaraswamy.py b/tensorflow/contrib/distributions/python/ops/kumaraswamy.py
index 66682b2ff5..192dede6ff 100644
--- a/tensorflow/contrib/distributions/python/ops/kumaraswamy.py
+++ b/tensorflow/contrib/distributions/python/ops/kumaraswamy.py
@@ -151,11 +151,10 @@ class Kumaraswamy(transformed_distribution.TransformedDistribution):
more of the statistic's batch members are undefined.
name: Python `str` name prefixed to Ops created by this class.
"""
- with ops.name_scope(name, values=[concentration1, concentration0]) as name:
- concentration1 = ops.convert_to_tensor(
- concentration1, name="concentration1")
- concentration0 = ops.convert_to_tensor(
- concentration0, name="concentration0")
+ concentration1 = ops.convert_to_tensor(
+ concentration1, name="concentration1")
+ concentration0 = ops.convert_to_tensor(
+ concentration0, name="concentration0")
super(Kumaraswamy, self).__init__(
distribution=uniform.Uniform(
low=array_ops.zeros([], dtype=concentration1.dtype),
diff --git a/tensorflow/contrib/distributions/python/ops/logistic.py b/tensorflow/contrib/distributions/python/ops/logistic.py
index c83b5bc2e3..68e6bca5a5 100644
--- a/tensorflow/contrib/distributions/python/ops/logistic.py
+++ b/tensorflow/contrib/distributions/python/ops/logistic.py
@@ -120,7 +120,7 @@ class Logistic(distribution.Distribution):
TypeError: if loc and scale are different dtypes.
"""
parameters = locals()
- with ops.name_scope(name, values=[loc, scale]) as name:
+ with ops.name_scope(name, values=[loc, scale]):
with ops.control_dependencies([check_ops.assert_positive(scale)] if
validate_args else []):
self._loc = array_ops.identity(loc, name="loc")
diff --git a/tensorflow/contrib/distributions/python/ops/mixture.py b/tensorflow/contrib/distributions/python/ops/mixture.py
index 2ef294af2e..cef6a143fc 100644
--- a/tensorflow/contrib/distributions/python/ops/mixture.py
+++ b/tensorflow/contrib/distributions/python/ops/mixture.py
@@ -145,7 +145,7 @@ class Mixture(distribution.Distribution):
"none of the components provide a static number of ndims")
# Ensure that all batch and event ndims are consistent.
- with ops.name_scope(name, values=[cat.logits]) as name:
+ with ops.name_scope(name, values=[cat.logits]):
num_components = cat.event_size
static_num_components = tensor_util.constant_value(num_components)
if static_num_components is None:
diff --git a/tensorflow/contrib/distributions/python/ops/mixture_same_family.py b/tensorflow/contrib/distributions/python/ops/mixture_same_family.py
index 0b1301e551..b93bdc5ab4 100644
--- a/tensorflow/contrib/distributions/python/ops/mixture_same_family.py
+++ b/tensorflow/contrib/distributions/python/ops/mixture_same_family.py
@@ -131,7 +131,7 @@ class MixtureSameFamily(distribution.Distribution):
`components_distribution` rightmost batch shape.
"""
parameters = locals()
- with ops.name_scope(name) as name:
+ with ops.name_scope(name):
self._mixture_distribution = mixture_distribution
self._components_distribution = components_distribution
self._runtime_assertions = []
diff --git a/tensorflow/contrib/distributions/python/ops/mvn_diag.py b/tensorflow/contrib/distributions/python/ops/mvn_diag.py
index e3236c2db9..e862552880 100644
--- a/tensorflow/contrib/distributions/python/ops/mvn_diag.py
+++ b/tensorflow/contrib/distributions/python/ops/mvn_diag.py
@@ -194,7 +194,7 @@ class MultivariateNormalDiag(
ValueError: if at most `scale_identity_multiplier` is specified.
"""
parameters = locals()
- with ops.name_scope(name) as name:
+ with ops.name_scope(name):
with ops.name_scope("init", values=[
loc, scale_diag, scale_identity_multiplier]):
# No need to validate_args while making diag_scale. The returned
@@ -225,7 +225,7 @@ class MultivariateNormalDiagWithSoftplusScale(MultivariateNormalDiag):
allow_nan_stats=True,
name="MultivariateNormalDiagWithSoftplusScale"):
parameters = locals()
- with ops.name_scope(name, values=[scale_diag]) as name:
+ with ops.name_scope(name, values=[scale_diag]):
super(MultivariateNormalDiagWithSoftplusScale, self).__init__(
loc=loc,
scale_diag=nn.softplus(scale_diag),
diff --git a/tensorflow/contrib/distributions/python/ops/mvn_diag_plus_low_rank.py b/tensorflow/contrib/distributions/python/ops/mvn_diag_plus_low_rank.py
index 2f6a6f198c..413e88f03a 100644
--- a/tensorflow/contrib/distributions/python/ops/mvn_diag_plus_low_rank.py
+++ b/tensorflow/contrib/distributions/python/ops/mvn_diag_plus_low_rank.py
@@ -218,7 +218,7 @@ class MultivariateNormalDiagPlusLowRank(
parameters = locals()
def _convert_to_tensor(x, name):
return None if x is None else ops.convert_to_tensor(x, name=name)
- with ops.name_scope(name) as name:
+ with ops.name_scope(name):
with ops.name_scope("init", values=[
loc, scale_diag, scale_identity_multiplier, scale_perturb_factor,
scale_perturb_diag]):
diff --git a/tensorflow/contrib/distributions/python/ops/mvn_full_covariance.py b/tensorflow/contrib/distributions/python/ops/mvn_full_covariance.py
index 86fcd4db54..4bea99fbb7 100644
--- a/tensorflow/contrib/distributions/python/ops/mvn_full_covariance.py
+++ b/tensorflow/contrib/distributions/python/ops/mvn_full_covariance.py
@@ -159,7 +159,7 @@ class MultivariateNormalFullCovariance(mvn_tril.MultivariateNormalTriL):
parameters = locals()
# Convert the covariance_matrix up to a scale_tril and call MVNTriL.
- with ops.name_scope(name) as name:
+ with ops.name_scope(name):
with ops.name_scope("init", values=[loc, covariance_matrix]):
if covariance_matrix is None:
scale_tril = None
diff --git a/tensorflow/contrib/distributions/python/ops/mvn_linear_operator.py b/tensorflow/contrib/distributions/python/ops/mvn_linear_operator.py
index 44c92312c7..a739979289 100644
--- a/tensorflow/contrib/distributions/python/ops/mvn_linear_operator.py
+++ b/tensorflow/contrib/distributions/python/ops/mvn_linear_operator.py
@@ -176,7 +176,7 @@ class MultivariateNormalLinearOperator(
if not scale.dtype.is_floating:
raise TypeError("`scale` parameter must have floating-point dtype.")
- with ops.name_scope(name, values=[loc] + scale.graph_parents) as name:
+ with ops.name_scope(name, values=[loc] + scale.graph_parents):
# Since expand_dims doesn't preserve constant-ness, we obtain the
# non-dynamic value if possible.
loc = ops.convert_to_tensor(loc, name="loc") if loc is not None else loc
diff --git a/tensorflow/contrib/distributions/python/ops/mvn_tril.py b/tensorflow/contrib/distributions/python/ops/mvn_tril.py
index d6f8b731cb..6c7dc4ca7a 100644
--- a/tensorflow/contrib/distributions/python/ops/mvn_tril.py
+++ b/tensorflow/contrib/distributions/python/ops/mvn_tril.py
@@ -184,7 +184,7 @@ class MultivariateNormalTriL(
return None if x is None else ops.convert_to_tensor(x, name=name)
if loc is None and scale_tril is None:
raise ValueError("Must specify one or both of `loc`, `scale_tril`.")
- with ops.name_scope(name) as name:
+ with ops.name_scope(name):
with ops.name_scope("init", values=[loc, scale_tril]):
loc = _convert_to_tensor(loc, name="loc")
scale_tril = _convert_to_tensor(scale_tril, name="scale_tril")
diff --git a/tensorflow/contrib/distributions/python/ops/negative_binomial.py b/tensorflow/contrib/distributions/python/ops/negative_binomial.py
index eeaf9c0a5e..3a58df80da 100644
--- a/tensorflow/contrib/distributions/python/ops/negative_binomial.py
+++ b/tensorflow/contrib/distributions/python/ops/negative_binomial.py
@@ -91,7 +91,7 @@ class NegativeBinomial(distribution.Distribution):
"""
parameters = locals()
- with ops.name_scope(name, values=[total_count, logits, probs]) as name:
+ with ops.name_scope(name, values=[total_count, logits, probs]):
self._logits, self._probs = distribution_util.get_logits_and_probs(
logits, probs, validate_args=validate_args, name=name)
with ops.control_dependencies(
diff --git a/tensorflow/contrib/distributions/python/ops/onehot_categorical.py b/tensorflow/contrib/distributions/python/ops/onehot_categorical.py
index fd5e8b10b0..46c2cc8b7a 100644
--- a/tensorflow/contrib/distributions/python/ops/onehot_categorical.py
+++ b/tensorflow/contrib/distributions/python/ops/onehot_categorical.py
@@ -116,7 +116,7 @@ class OneHotCategorical(distribution.Distribution):
name: Python `str` name prefixed to Ops created by this class.
"""
parameters = locals()
- with ops.name_scope(name, values=[logits, probs]) as name:
+ with ops.name_scope(name, values=[logits, probs]):
self._logits, self._probs = distribution_util.get_logits_and_probs(
name=name, logits=logits, probs=probs, validate_args=validate_args,
multidimensional=True)
diff --git a/tensorflow/contrib/distributions/python/ops/poisson.py b/tensorflow/contrib/distributions/python/ops/poisson.py
index a84aad6fc9..02e97c0a2f 100644
--- a/tensorflow/contrib/distributions/python/ops/poisson.py
+++ b/tensorflow/contrib/distributions/python/ops/poisson.py
@@ -94,7 +94,7 @@ class Poisson(distribution.Distribution):
TypeError: if `log_rate` is not a float-type.
"""
parameters = locals()
- with ops.name_scope(name, values=[rate]) as name:
+ with ops.name_scope(name, values=[rate]):
if (rate is None) == (log_rate is None):
raise ValueError("Must specify exactly one of `rate` and `log_rate`.")
elif log_rate is None:
diff --git a/tensorflow/contrib/distributions/python/ops/poisson_lognormal.py b/tensorflow/contrib/distributions/python/ops/poisson_lognormal.py
index ea5514d345..92f2bba182 100644
--- a/tensorflow/contrib/distributions/python/ops/poisson_lognormal.py
+++ b/tensorflow/contrib/distributions/python/ops/poisson_lognormal.py
@@ -256,7 +256,7 @@ class PoissonLogNormalQuadratureCompound(distribution_lib.Distribution):
`dtype`.
"""
parameters = locals()
- with ops.name_scope(name, values=[loc, scale]) as name:
+ with ops.name_scope(name, values=[loc, scale]):
if loc is not None:
loc = ops.convert_to_tensor(loc, name="loc")
if scale is not None:
diff --git a/tensorflow/contrib/distributions/python/ops/quantized_distribution.py b/tensorflow/contrib/distributions/python/ops/quantized_distribution.py
index 1ef7651d03..8aebb79b91 100644
--- a/tensorflow/contrib/distributions/python/ops/quantized_distribution.py
+++ b/tensorflow/contrib/distributions/python/ops/quantized_distribution.py
@@ -217,7 +217,7 @@ class QuantizedDistribution(distributions.Distribution):
values = (
list(distribution.parameters.values()) +
[low, high])
- with ops.name_scope(name, values=values) as name:
+ with ops.name_scope(name, values=values):
self._dist = distribution
if low is not None:
diff --git a/tensorflow/contrib/distributions/python/ops/relaxed_bernoulli.py b/tensorflow/contrib/distributions/python/ops/relaxed_bernoulli.py
index 00c1ede5c1..b525809015 100644
--- a/tensorflow/contrib/distributions/python/ops/relaxed_bernoulli.py
+++ b/tensorflow/contrib/distributions/python/ops/relaxed_bernoulli.py
@@ -166,7 +166,7 @@ class RelaxedBernoulli(transformed_distribution.TransformedDistribution):
ValueError: If both `probs` and `logits` are passed, or if neither.
"""
parameters = locals()
- with ops.name_scope(name, values=[logits, probs, temperature]) as name:
+ with ops.name_scope(name, values=[logits, probs, temperature]):
with ops.control_dependencies([check_ops.assert_positive(temperature)]
if validate_args else []):
self._temperature = array_ops.identity(temperature, name="temperature")
diff --git a/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py b/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py
index b60a4872aa..ff33f327c7 100644
--- a/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py
+++ b/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py
@@ -163,7 +163,7 @@ class ExpRelaxedOneHotCategorical(distribution.Distribution):
name: Python `str` name prefixed to Ops created by this class.
"""
parameters = locals()
- with ops.name_scope(name, values=[logits, probs, temperature]) as name:
+ with ops.name_scope(name, values=[logits, probs, temperature]):
self._logits, self._probs = distribution_util.get_logits_and_probs(
name=name, logits=logits, probs=probs, validate_args=validate_args,
diff --git a/tensorflow/contrib/distributions/python/ops/sinh_arcsinh.py b/tensorflow/contrib/distributions/python/ops/sinh_arcsinh.py
index 7a8f5bbfbe..0d8a192691 100644
--- a/tensorflow/contrib/distributions/python/ops/sinh_arcsinh.py
+++ b/tensorflow/contrib/distributions/python/ops/sinh_arcsinh.py
@@ -134,8 +134,7 @@ class SinhArcsinh(transformed_distribution.TransformedDistribution):
"""
parameters = locals()
- with ops.name_scope(name,
- values=[loc, scale, skewness, tailweight]) as name:
+ with ops.name_scope(name, values=[loc, scale, skewness, tailweight]):
loc = ops.convert_to_tensor(loc, name="loc")
dtype = loc.dtype
scale = ops.convert_to_tensor(scale, name="scale", dtype=dtype)
diff --git a/tensorflow/contrib/distributions/python/ops/vector_diffeomixture.py b/tensorflow/contrib/distributions/python/ops/vector_diffeomixture.py
index 026de97be7..971d65c4a6 100644
--- a/tensorflow/contrib/distributions/python/ops/vector_diffeomixture.py
+++ b/tensorflow/contrib/distributions/python/ops/vector_diffeomixture.py
@@ -396,7 +396,7 @@ class VectorDiffeomixture(distribution_lib.Distribution):
ValueError: if `not distribution.is_scalar_event`.
"""
parameters = locals()
- with ops.name_scope(name, values=[mix_loc, temperature]) as name:
+ with ops.name_scope(name, values=[mix_loc, temperature]):
if not scale or len(scale) < 2:
raise ValueError("Must specify list (or list-like object) of scale "
"LinearOperators, one for each component with "
diff --git a/tensorflow/contrib/distributions/python/ops/vector_exponential_diag.py b/tensorflow/contrib/distributions/python/ops/vector_exponential_diag.py
index e265b5d0f7..526fe2d39a 100644
--- a/tensorflow/contrib/distributions/python/ops/vector_exponential_diag.py
+++ b/tensorflow/contrib/distributions/python/ops/vector_exponential_diag.py
@@ -176,7 +176,7 @@ class VectorExponentialDiag(
ValueError: if at most `scale_identity_multiplier` is specified.
"""
parameters = locals()
- with ops.name_scope(name) as name:
+ with ops.name_scope(name):
with ops.name_scope("init", values=[
loc, scale_diag, scale_identity_multiplier]):
# No need to validate_args while making diag_scale. The returned
diff --git a/tensorflow/contrib/distributions/python/ops/vector_exponential_linear_operator.py b/tensorflow/contrib/distributions/python/ops/vector_exponential_linear_operator.py
index 89136d6760..9d5fd9ac41 100644
--- a/tensorflow/contrib/distributions/python/ops/vector_exponential_linear_operator.py
+++ b/tensorflow/contrib/distributions/python/ops/vector_exponential_linear_operator.py
@@ -181,7 +181,7 @@ class VectorExponentialLinearOperator(
if not scale.dtype.is_floating:
raise TypeError("`scale` parameter must have floating-point dtype.")
- with ops.name_scope(name, values=[loc] + scale.graph_parents) as name:
+ with ops.name_scope(name, values=[loc] + scale.graph_parents):
# Since expand_dims doesn't preserve constant-ness, we obtain the
# non-dynamic value if possible.
loc = ops.convert_to_tensor(loc, name="loc") if loc is not None else loc
diff --git a/tensorflow/contrib/distributions/python/ops/vector_sinh_arcsinh_diag.py b/tensorflow/contrib/distributions/python/ops/vector_sinh_arcsinh_diag.py
index b8ac7c10ca..003c66b941 100644
--- a/tensorflow/contrib/distributions/python/ops/vector_sinh_arcsinh_diag.py
+++ b/tensorflow/contrib/distributions/python/ops/vector_sinh_arcsinh_diag.py
@@ -169,7 +169,7 @@ class VectorSinhArcsinhDiag(transformed_distribution.TransformedDistribution):
name,
values=[
loc, scale_diag, scale_identity_multiplier, skewness, tailweight
- ]) as name:
+ ]):
loc = ops.convert_to_tensor(loc, name="loc") if loc is not None else loc
tailweight = 1. if tailweight is None else tailweight
has_default_skewness = skewness is None
diff --git a/tensorflow/contrib/distributions/python/ops/vector_student_t.py b/tensorflow/contrib/distributions/python/ops/vector_student_t.py
index 23a01cc95c..8c67647a61 100644
--- a/tensorflow/contrib/distributions/python/ops/vector_student_t.py
+++ b/tensorflow/contrib/distributions/python/ops/vector_student_t.py
@@ -178,7 +178,7 @@ class _VectorStudentT(transformed_distribution.TransformedDistribution):
parameters = locals()
graph_parents = [df, loc, scale_identity_multiplier, scale_diag,
scale_tril, scale_perturb_factor, scale_perturb_diag]
- with ops.name_scope(name) as name:
+ with ops.name_scope(name):
with ops.name_scope("init", values=graph_parents):
# The shape of the _VectorStudentT distribution is governed by the
# relationship between df.batch_shape and affine.batch_shape. In
diff --git a/tensorflow/contrib/distributions/python/ops/wishart.py b/tensorflow/contrib/distributions/python/ops/wishart.py
index 91453fed5d..5a8c94dabf 100644
--- a/tensorflow/contrib/distributions/python/ops/wishart.py
+++ b/tensorflow/contrib/distributions/python/ops/wishart.py
@@ -109,7 +109,7 @@ class _WishartLinearOperator(distribution.Distribution):
"""
parameters = locals()
self._cholesky_input_output_matrices = cholesky_input_output_matrices
- with ops.name_scope(name) as name:
+ with ops.name_scope(name) as ns:
with ops.name_scope("init", values=[df, scale_operator]):
if not scale_operator.dtype.is_floating:
raise TypeError(
@@ -163,7 +163,7 @@ class _WishartLinearOperator(distribution.Distribution):
parameters=parameters,
graph_parents=([self._df, self._dimension] +
self._scale_operator.graph_parents),
- name=name)
+ name=ns)
@property
def df(self):
@@ -531,7 +531,7 @@ class WishartCholesky(_WishartLinearOperator):
name: Python `str` name prefixed to Ops created by this class.
"""
parameters = locals()
- with ops.name_scope(name, values=[scale]) as name:
+ with ops.name_scope(name, values=[scale]):
with ops.name_scope("init", values=[scale]):
scale = ops.convert_to_tensor(scale)
if validate_args:
@@ -647,7 +647,7 @@ class WishartFull(_WishartLinearOperator):
name: Python `str` name prefixed to Ops created by this class.
"""
parameters = locals()
- with ops.name_scope(name) as name:
+ with ops.name_scope(name) as ns:
with ops.name_scope("init", values=[scale]):
scale = ops.convert_to_tensor(scale)
if validate_args:
@@ -666,5 +666,5 @@ class WishartFull(_WishartLinearOperator):
cholesky_input_output_matrices=cholesky_input_output_matrices,
validate_args=validate_args,
allow_nan_stats=allow_nan_stats,
- name=name)
+ name=ns)
self._parameters = parameters