aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/ops
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-10-02 12:47:05 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-02 12:55:58 -0700
commit0a201955b47d484c6bfa149364c264a5b5f91be7 (patch)
tree76aa293a8675b789ab43b28b3d2e39e9df627a0f /tensorflow/python/ops
parent508dd179b6b6dd78aa3e24212648789e8fc018a0 (diff)
Copy tf.distributions to tfp.distributions, and deprecate the tf.distributions API.
PiperOrigin-RevId: 215441733
Diffstat (limited to 'tensorflow/python/ops')
-rw-r--r--tensorflow/python/ops/distributions/BUILD7
-rw-r--r--tensorflow/python/ops/distributions/bernoulli.py9
-rw-r--r--tensorflow/python/ops/distributions/beta.py14
-rw-r--r--tensorflow/python/ops/distributions/categorical.py9
-rw-r--r--tensorflow/python/ops/distributions/dirichlet.py9
-rw-r--r--tensorflow/python/ops/distributions/dirichlet_multinomial.py9
-rw-r--r--tensorflow/python/ops/distributions/distribution.py17
-rw-r--r--tensorflow/python/ops/distributions/exponential.py13
-rw-r--r--tensorflow/python/ops/distributions/gamma.py14
-rw-r--r--tensorflow/python/ops/distributions/identity_bijector.py9
-rw-r--r--tensorflow/python/ops/distributions/kullback_leibler.py25
-rw-r--r--tensorflow/python/ops/distributions/laplace.py14
-rw-r--r--tensorflow/python/ops/distributions/multinomial.py9
-rw-r--r--tensorflow/python/ops/distributions/normal.py14
-rw-r--r--tensorflow/python/ops/distributions/student_t.py14
-rw-r--r--tensorflow/python/ops/distributions/transformed_distribution.py9
-rw-r--r--tensorflow/python/ops/distributions/uniform.py9
17 files changed, 204 insertions, 0 deletions
diff --git a/tensorflow/python/ops/distributions/BUILD b/tensorflow/python/ops/distributions/BUILD
index e7ad028376..59ba9aee59 100644
--- a/tensorflow/python/ops/distributions/BUILD
+++ b/tensorflow/python/ops/distributions/BUILD
@@ -12,6 +12,13 @@ py_library(
["*.py"],
exclude = ["util.py"],
),
+ deprecation = ("TensorFlow Distributions has migrated to " +
+ "TensorFlow Probability " +
+ "(https://github.com/tensorflow/probability). " +
+ "Deprecated copies remaining in tf.distributions " +
+ "will not receive new features, and will be removed by " +
+ "early 2019. You should update all usage of " +
+ "`tf.distributions` to `tfp.distributions`."),
srcs_version = "PY2AND3",
deps = [
":util",
diff --git a/tensorflow/python/ops/distributions/bernoulli.py b/tensorflow/python/ops/distributions/bernoulli.py
index 84d9d40a35..baecc321d3 100644
--- a/tensorflow/python/ops/distributions/bernoulli.py
+++ b/tensorflow/python/ops/distributions/bernoulli.py
@@ -28,6 +28,7 @@ from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import kullback_leibler
from tensorflow.python.ops.distributions import util as distribution_util
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -39,6 +40,14 @@ class Bernoulli(distribution.Distribution):
`1` outcome (vs a `0` outcome).
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
logits=None,
probs=None,
diff --git a/tensorflow/python/ops/distributions/beta.py b/tensorflow/python/ops/distributions/beta.py
index d6f89a3517..51c4f6eb3d 100644
--- a/tensorflow/python/ops/distributions/beta.py
+++ b/tensorflow/python/ops/distributions/beta.py
@@ -33,6 +33,7 @@ from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import kullback_leibler
from tensorflow.python.ops.distributions import util as distribution_util
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -150,6 +151,14 @@ class Beta(distribution.Distribution):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
concentration1=None,
concentration0=None,
@@ -341,6 +350,11 @@ class Beta(distribution.Distribution):
class BetaWithSoftplusConcentration(Beta):
"""Beta with softplus transform of `concentration1` and `concentration0`."""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "Use `tfd.Beta(tf.nn.softplus(concentration1), "
+ "tf.nn.softplus(concentration2))` instead.",
+ warn_once=True)
def __init__(self,
concentration1,
concentration0,
diff --git a/tensorflow/python/ops/distributions/categorical.py b/tensorflow/python/ops/distributions/categorical.py
index fbbacf2521..26a3da2fb6 100644
--- a/tensorflow/python/ops/distributions/categorical.py
+++ b/tensorflow/python/ops/distributions/categorical.py
@@ -29,6 +29,7 @@ from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import kullback_leibler
from tensorflow.python.ops.distributions import util as distribution_util
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -149,6 +150,14 @@ class Categorical(distribution.Distribution):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(
self,
logits=None,
diff --git a/tensorflow/python/ops/distributions/dirichlet.py b/tensorflow/python/ops/distributions/dirichlet.py
index 997b1d392d..675c30b383 100644
--- a/tensorflow/python/ops/distributions/dirichlet.py
+++ b/tensorflow/python/ops/distributions/dirichlet.py
@@ -30,6 +30,7 @@ from tensorflow.python.ops import special_math_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import kullback_leibler
from tensorflow.python.ops.distributions import util as distribution_util
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -156,6 +157,14 @@ class Dirichlet(distribution.Distribution):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
concentration,
validate_args=False,
diff --git a/tensorflow/python/ops/distributions/dirichlet_multinomial.py b/tensorflow/python/ops/distributions/dirichlet_multinomial.py
index 5350c82847..2e3151a5ab 100644
--- a/tensorflow/python/ops/distributions/dirichlet_multinomial.py
+++ b/tensorflow/python/ops/distributions/dirichlet_multinomial.py
@@ -28,6 +28,7 @@ from tensorflow.python.ops import random_ops
from tensorflow.python.ops import special_math_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import util as distribution_util
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -163,6 +164,14 @@ class DirichletMultinomial(distribution.Distribution):
# TODO(b/27419586) Change docstring for dtype of concentration once int
# allowed.
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
total_count,
concentration,
diff --git a/tensorflow/python/ops/distributions/distribution.py b/tensorflow/python/ops/distributions/distribution.py
index 12fd039392..4741370cd8 100644
--- a/tensorflow/python/ops/distributions/distribution.py
+++ b/tensorflow/python/ops/distributions/distribution.py
@@ -34,6 +34,7 @@ from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops.distributions import kullback_leibler
from tensorflow.python.ops.distributions import util
+from tensorflow.python.util import deprecation
from tensorflow.python.util import tf_inspect
from tensorflow.python.util.tf_export import tf_export
@@ -229,6 +230,14 @@ class ReparameterizationType(object):
gradients / surrogate loss instead.
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self, rep_type):
self._rep_type = rep_type
@@ -405,6 +414,14 @@ class Distribution(_BaseDistribution):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
dtype,
reparameterization_type,
diff --git a/tensorflow/python/ops/distributions/exponential.py b/tensorflow/python/ops/distributions/exponential.py
index 02129b5e2a..6a52af8c33 100644
--- a/tensorflow/python/ops/distributions/exponential.py
+++ b/tensorflow/python/ops/distributions/exponential.py
@@ -27,6 +27,7 @@ from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import gamma
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -70,6 +71,14 @@ class Exponential(gamma.Gamma):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
rate,
validate_args=False,
@@ -138,6 +147,10 @@ class Exponential(gamma.Gamma):
class ExponentialWithSoftplusRate(Exponential):
"""Exponential with softplus transform on `rate`."""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "Use `tfd.Exponential(tf.nn.softplus(rate)).",
+ warn_once=True)
def __init__(self,
rate,
validate_args=False,
diff --git a/tensorflow/python/ops/distributions/gamma.py b/tensorflow/python/ops/distributions/gamma.py
index bbc64da7bc..4a2db208d4 100644
--- a/tensorflow/python/ops/distributions/gamma.py
+++ b/tensorflow/python/ops/distributions/gamma.py
@@ -33,6 +33,7 @@ from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import kullback_leibler
from tensorflow.python.ops.distributions import util as distribution_util
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -121,6 +122,14 @@ class Gamma(distribution.Distribution):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
concentration,
rate,
@@ -279,6 +288,11 @@ class Gamma(distribution.Distribution):
class GammaWithSoftplusConcentrationRate(Gamma):
"""`Gamma` with softplus of `concentration` and `rate`."""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "Use `tfd.Gamma(tf.nn.softplus(concentration), "
+ "tf.nn.softplus(rate))` instead.",
+ warn_once=True)
def __init__(self,
concentration,
rate,
diff --git a/tensorflow/python/ops/distributions/identity_bijector.py b/tensorflow/python/ops/distributions/identity_bijector.py
index 8628e68f96..eded96f5bc 100644
--- a/tensorflow/python/ops/distributions/identity_bijector.py
+++ b/tensorflow/python/ops/distributions/identity_bijector.py
@@ -20,6 +20,7 @@ from __future__ import print_function
from tensorflow.python.framework import constant_op
from tensorflow.python.ops.distributions import bijector
+from tensorflow.python.util import deprecation
__all__ = [
@@ -43,6 +44,14 @@ class Identity(bijector.Bijector):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self, validate_args=False, name="identity"):
super(Identity, self).__init__(
forward_min_event_ndims=0,
diff --git a/tensorflow/python/ops/distributions/kullback_leibler.py b/tensorflow/python/ops/distributions/kullback_leibler.py
index fdeb97bf64..12743fa23d 100644
--- a/tensorflow/python/ops/distributions/kullback_leibler.py
+++ b/tensorflow/python/ops/distributions/kullback_leibler.py
@@ -22,6 +22,7 @@ from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
+from tensorflow.python.util import deprecation
from tensorflow.python.util import tf_inspect
from tensorflow.python.util.tf_export import tf_export
@@ -51,6 +52,14 @@ def _registered_kl(type_a, type_b):
return kl_fn
+@deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
@tf_export("distributions.kl_divergence")
def kl_divergence(distribution_a, distribution_b,
allow_nan_stats=True, name=None):
@@ -112,6 +121,14 @@ def kl_divergence(distribution_a, distribution_b,
return array_ops.identity(kl_t, name="checked_kl")
+@deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def cross_entropy(ref, other,
allow_nan_stats=True, name=None):
"""Computes the (Shannon) cross entropy.
@@ -155,6 +172,14 @@ class RegisterKL(object):
# Return KL(norm_a || norm_b)
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self, dist_cls_a, dist_cls_b):
"""Initialize the KL registrar.
diff --git a/tensorflow/python/ops/distributions/laplace.py b/tensorflow/python/ops/distributions/laplace.py
index be17cf2527..4f6a8f587d 100644
--- a/tensorflow/python/ops/distributions/laplace.py
+++ b/tensorflow/python/ops/distributions/laplace.py
@@ -33,6 +33,7 @@ from tensorflow.python.ops import nn
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import special_math
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -71,6 +72,14 @@ class Laplace(distribution.Distribution):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
loc,
scale,
@@ -211,6 +220,11 @@ class Laplace(distribution.Distribution):
class LaplaceWithSoftplusScale(Laplace):
"""Laplace with softplus applied to `scale`."""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "Use `tfd.Laplace(loc, tf.nn.softplus(scale)) "
+ "instead.",
+ warn_once=True)
def __init__(self,
loc,
scale,
diff --git a/tensorflow/python/ops/distributions/multinomial.py b/tensorflow/python/ops/distributions/multinomial.py
index d0943e8eee..8397353cd5 100644
--- a/tensorflow/python/ops/distributions/multinomial.py
+++ b/tensorflow/python/ops/distributions/multinomial.py
@@ -29,6 +29,7 @@ from tensorflow.python.ops import nn_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import util as distribution_util
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -148,6 +149,14 @@ class Multinomial(distribution.Distribution):
```
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
total_count,
logits=None,
diff --git a/tensorflow/python/ops/distributions/normal.py b/tensorflow/python/ops/distributions/normal.py
index 2feaf806c0..9f511709b9 100644
--- a/tensorflow/python/ops/distributions/normal.py
+++ b/tensorflow/python/ops/distributions/normal.py
@@ -32,6 +32,7 @@ from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import kullback_leibler
from tensorflow.python.ops.distributions import special_math
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -106,6 +107,14 @@ class Normal(distribution.Distribution):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
loc,
scale,
@@ -240,6 +249,11 @@ class Normal(distribution.Distribution):
class NormalWithSoftplusScale(Normal):
"""Normal with softplus applied to `scale`."""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "Use `tfd.Normal(loc, tf.nn.softplus(scale)) "
+ "instead.",
+ warn_once=True)
def __init__(self,
loc,
scale,
diff --git a/tensorflow/python/ops/distributions/student_t.py b/tensorflow/python/ops/distributions/student_t.py
index e8d214bbe0..b69e61925c 100644
--- a/tensorflow/python/ops/distributions/student_t.py
+++ b/tensorflow/python/ops/distributions/student_t.py
@@ -33,6 +33,7 @@ from tensorflow.python.ops import random_ops
from tensorflow.python.ops import special_math_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import util as distribution_util
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -140,6 +141,14 @@ class StudentT(distribution.Distribution):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
df,
loc,
@@ -361,6 +370,11 @@ class StudentT(distribution.Distribution):
class StudentTWithAbsDfSoftplusScale(StudentT):
"""StudentT with `df = floor(abs(df))` and `scale = softplus(scale)`."""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "Use `tfd.StudentT(tf.floor(tf.abs(df)), loc, "
+ "tf.nn.softplus(scale)) instead.",
+ warn_once=True)
def __init__(self,
df,
loc,
diff --git a/tensorflow/python/ops/distributions/transformed_distribution.py b/tensorflow/python/ops/distributions/transformed_distribution.py
index e80bf9ee42..1becfc1877 100644
--- a/tensorflow/python/ops/distributions/transformed_distribution.py
+++ b/tensorflow/python/ops/distributions/transformed_distribution.py
@@ -30,6 +30,7 @@ from tensorflow.python.ops import math_ops
from tensorflow.python.ops.distributions import distribution as distribution_lib
from tensorflow.python.ops.distributions import identity_bijector
from tensorflow.python.ops.distributions import util as distribution_util
+from tensorflow.python.util import deprecation
__all__ = [
"TransformedDistribution",
@@ -227,6 +228,14 @@ class TransformedDistribution(distribution_lib.Distribution):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
distribution,
bijector=None,
diff --git a/tensorflow/python/ops/distributions/uniform.py b/tensorflow/python/ops/distributions/uniform.py
index e66c4a37e7..b6b24187cc 100644
--- a/tensorflow/python/ops/distributions/uniform.py
+++ b/tensorflow/python/ops/distributions/uniform.py
@@ -29,6 +29,7 @@ from tensorflow.python.ops import check_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
+from tensorflow.python.util import deprecation
from tensorflow.python.util.tf_export import tf_export
@@ -76,6 +77,14 @@ class Uniform(distribution.Distribution):
"""
+ @deprecation.deprecated(
+ "2019-01-01",
+ "The TensorFlow Distributions library has moved to "
+ "TensorFlow Probability "
+ "(https://github.com/tensorflow/probability). You "
+ "should update all references to use `tfp.distributions` "
+ "instead of `tf.distributions`.",
+ warn_once=True)
def __init__(self,
low=0.,
high=1.,