aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Pavel Sountsov <siege@google.com>2018-10-09 11:56:25 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-09 12:03:38 -0700
commit8c2a52b26f21167ed0fcec7859850e38d0c216f9 (patch)
treeaf808bef14df5ab8d0c0c0b2172d695c5f194ae1
parent072fcb995a3fd658ee2461b59b159498c710513d (diff)
Silence tf.distributions deprecation messages caused by internal global function calls.
E.g. register_kl calls would trigger such warnings. This spam was exacerbated by the fact that it happens before logging is initialized, so it is dumped prominently to STDERR. Worse yet it also happened no matter whether the user imported any symbols from tf.distributions or not as the relevant code is executed when you import TensorFlow. PiperOrigin-RevId: 216396036
-rw-r--r--tensorflow/contrib/distributions/__init__.py128
-rw-r--r--tensorflow/python/ops/distributions/distributions.py35
2 files changed, 85 insertions, 78 deletions
diff --git a/tensorflow/contrib/distributions/__init__.py b/tensorflow/contrib/distributions/__init__.py
index 5cec93c4df..343eae3440 100644
--- a/tensorflow/contrib/distributions/__init__.py
+++ b/tensorflow/contrib/distributions/__init__.py
@@ -18,69 +18,73 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-# pylint: disable=unused-import,wildcard-import,line-too-long,g-importing-member
+from tensorflow.python.util import deprecation
-from tensorflow.contrib.distributions.python.ops import bijectors
-from tensorflow.contrib.distributions.python.ops.autoregressive import *
-from tensorflow.contrib.distributions.python.ops.batch_reshape import *
-from tensorflow.contrib.distributions.python.ops.binomial import *
-from tensorflow.contrib.distributions.python.ops.cauchy import *
-from tensorflow.contrib.distributions.python.ops.chi2 import *
-from tensorflow.contrib.distributions.python.ops.conditional_distribution import *
-from tensorflow.contrib.distributions.python.ops.conditional_transformed_distribution import *
-from tensorflow.contrib.distributions.python.ops.deterministic import *
-from tensorflow.contrib.distributions.python.ops.distribution_util import fill_triangular
-from tensorflow.contrib.distributions.python.ops.distribution_util import fill_triangular_inverse
-from tensorflow.contrib.distributions.python.ops.distribution_util import matrix_diag_transform
-from tensorflow.contrib.distributions.python.ops.distribution_util import reduce_weighted_logsumexp
-from tensorflow.contrib.distributions.python.ops.distribution_util import softplus_inverse
-from tensorflow.contrib.distributions.python.ops.distribution_util import tridiag
-from tensorflow.contrib.distributions.python.ops.estimator import *
-from tensorflow.contrib.distributions.python.ops.geometric import *
-from tensorflow.contrib.distributions.python.ops.half_normal import *
-from tensorflow.contrib.distributions.python.ops.independent import *
-from tensorflow.contrib.distributions.python.ops.inverse_gamma import *
-from tensorflow.contrib.distributions.python.ops.kumaraswamy import *
-from tensorflow.contrib.distributions.python.ops.logistic import *
-from tensorflow.contrib.distributions.python.ops.mixture import *
-from tensorflow.contrib.distributions.python.ops.mixture_same_family import *
-from tensorflow.contrib.distributions.python.ops.moving_stats import *
-from tensorflow.contrib.distributions.python.ops.mvn_diag import *
-from tensorflow.contrib.distributions.python.ops.mvn_diag_plus_low_rank import *
-from tensorflow.contrib.distributions.python.ops.mvn_full_covariance import *
-from tensorflow.contrib.distributions.python.ops.mvn_tril import *
-from tensorflow.contrib.distributions.python.ops.negative_binomial import *
-from tensorflow.contrib.distributions.python.ops.normal_conjugate_posteriors import *
-from tensorflow.contrib.distributions.python.ops.onehot_categorical import *
-from tensorflow.contrib.distributions.python.ops.poisson import *
-from tensorflow.contrib.distributions.python.ops.poisson_lognormal import *
-from tensorflow.contrib.distributions.python.ops.quantized_distribution import *
-from tensorflow.contrib.distributions.python.ops.relaxed_bernoulli import *
-from tensorflow.contrib.distributions.python.ops.relaxed_onehot_categorical import *
-from tensorflow.contrib.distributions.python.ops.sample_stats import *
-from tensorflow.contrib.distributions.python.ops.seed_stream import *
-from tensorflow.contrib.distributions.python.ops.sinh_arcsinh import *
-from tensorflow.contrib.distributions.python.ops.test_util import *
-from tensorflow.contrib.distributions.python.ops.vector_diffeomixture import *
-from tensorflow.contrib.distributions.python.ops.vector_exponential_diag import *
-from tensorflow.contrib.distributions.python.ops.vector_laplace_diag import *
-from tensorflow.contrib.distributions.python.ops.vector_sinh_arcsinh_diag import *
-from tensorflow.contrib.distributions.python.ops.wishart import *
-from tensorflow.python.ops.distributions.bernoulli import *
-from tensorflow.python.ops.distributions.beta import *
-from tensorflow.python.ops.distributions.categorical import *
-from tensorflow.python.ops.distributions.dirichlet import *
-from tensorflow.python.ops.distributions.dirichlet_multinomial import *
-from tensorflow.python.ops.distributions.distribution import *
-from tensorflow.python.ops.distributions.exponential import *
-from tensorflow.python.ops.distributions.gamma import *
-from tensorflow.python.ops.distributions.kullback_leibler import *
-from tensorflow.python.ops.distributions.laplace import *
-from tensorflow.python.ops.distributions.multinomial import *
-from tensorflow.python.ops.distributions.normal import *
-from tensorflow.python.ops.distributions.student_t import *
-from tensorflow.python.ops.distributions.transformed_distribution import *
-from tensorflow.python.ops.distributions.uniform import *
+
+# pylint: disable=unused-import,wildcard-import,line-too-long,g-importing-member,g-import-not-at-top
+
+with deprecation.silence():
+ from tensorflow.contrib.distributions.python.ops import bijectors
+ from tensorflow.contrib.distributions.python.ops.autoregressive import *
+ from tensorflow.contrib.distributions.python.ops.batch_reshape import *
+ from tensorflow.contrib.distributions.python.ops.binomial import *
+ from tensorflow.contrib.distributions.python.ops.cauchy import *
+ from tensorflow.contrib.distributions.python.ops.chi2 import *
+ from tensorflow.contrib.distributions.python.ops.conditional_distribution import *
+ from tensorflow.contrib.distributions.python.ops.conditional_transformed_distribution import *
+ from tensorflow.contrib.distributions.python.ops.deterministic import *
+ from tensorflow.contrib.distributions.python.ops.distribution_util import fill_triangular
+ from tensorflow.contrib.distributions.python.ops.distribution_util import fill_triangular_inverse
+ from tensorflow.contrib.distributions.python.ops.distribution_util import matrix_diag_transform
+ from tensorflow.contrib.distributions.python.ops.distribution_util import reduce_weighted_logsumexp
+ from tensorflow.contrib.distributions.python.ops.distribution_util import softplus_inverse
+ from tensorflow.contrib.distributions.python.ops.distribution_util import tridiag
+ from tensorflow.contrib.distributions.python.ops.estimator import *
+ from tensorflow.contrib.distributions.python.ops.geometric import *
+ from tensorflow.contrib.distributions.python.ops.half_normal import *
+ from tensorflow.contrib.distributions.python.ops.independent import *
+ from tensorflow.contrib.distributions.python.ops.inverse_gamma import *
+ from tensorflow.contrib.distributions.python.ops.kumaraswamy import *
+ from tensorflow.contrib.distributions.python.ops.logistic import *
+ from tensorflow.contrib.distributions.python.ops.mixture import *
+ from tensorflow.contrib.distributions.python.ops.mixture_same_family import *
+ from tensorflow.contrib.distributions.python.ops.moving_stats import *
+ from tensorflow.contrib.distributions.python.ops.mvn_diag import *
+ from tensorflow.contrib.distributions.python.ops.mvn_diag_plus_low_rank import *
+ from tensorflow.contrib.distributions.python.ops.mvn_full_covariance import *
+ from tensorflow.contrib.distributions.python.ops.mvn_tril import *
+ from tensorflow.contrib.distributions.python.ops.negative_binomial import *
+ from tensorflow.contrib.distributions.python.ops.normal_conjugate_posteriors import *
+ from tensorflow.contrib.distributions.python.ops.onehot_categorical import *
+ from tensorflow.contrib.distributions.python.ops.poisson import *
+ from tensorflow.contrib.distributions.python.ops.poisson_lognormal import *
+ from tensorflow.contrib.distributions.python.ops.quantized_distribution import *
+ from tensorflow.contrib.distributions.python.ops.relaxed_bernoulli import *
+ from tensorflow.contrib.distributions.python.ops.relaxed_onehot_categorical import *
+ from tensorflow.contrib.distributions.python.ops.sample_stats import *
+ from tensorflow.contrib.distributions.python.ops.seed_stream import *
+ from tensorflow.contrib.distributions.python.ops.sinh_arcsinh import *
+ from tensorflow.contrib.distributions.python.ops.test_util import *
+ from tensorflow.contrib.distributions.python.ops.vector_diffeomixture import *
+ from tensorflow.contrib.distributions.python.ops.vector_exponential_diag import *
+ from tensorflow.contrib.distributions.python.ops.vector_laplace_diag import *
+ from tensorflow.contrib.distributions.python.ops.vector_sinh_arcsinh_diag import *
+ from tensorflow.contrib.distributions.python.ops.wishart import *
+ from tensorflow.python.ops.distributions.bernoulli import *
+ from tensorflow.python.ops.distributions.beta import *
+ from tensorflow.python.ops.distributions.categorical import *
+ from tensorflow.python.ops.distributions.dirichlet import *
+ from tensorflow.python.ops.distributions.dirichlet_multinomial import *
+ from tensorflow.python.ops.distributions.distribution import *
+ from tensorflow.python.ops.distributions.exponential import *
+ from tensorflow.python.ops.distributions.gamma import *
+ from tensorflow.python.ops.distributions.kullback_leibler import *
+ from tensorflow.python.ops.distributions.laplace import *
+ from tensorflow.python.ops.distributions.multinomial import *
+ from tensorflow.python.ops.distributions.normal import *
+ from tensorflow.python.ops.distributions.student_t import *
+ from tensorflow.python.ops.distributions.transformed_distribution import *
+ from tensorflow.python.ops.distributions.uniform import *
# pylint: enable=unused-import,wildcard-import,line-too-long,g-importing-member
diff --git a/tensorflow/python/ops/distributions/distributions.py b/tensorflow/python/ops/distributions/distributions.py
index 59ed455e43..b18caa5b2e 100644
--- a/tensorflow/python/ops/distributions/distributions.py
+++ b/tensorflow/python/ops/distributions/distributions.py
@@ -17,21 +17,24 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
+from tensorflow.python.util import deprecation
-# pylint: disable=wildcard-import,unused-import
-from tensorflow.python.ops.distributions.bernoulli import Bernoulli
-from tensorflow.python.ops.distributions.beta import Beta
-from tensorflow.python.ops.distributions.categorical import Categorical
-from tensorflow.python.ops.distributions.dirichlet import Dirichlet
-from tensorflow.python.ops.distributions.dirichlet_multinomial import DirichletMultinomial
-from tensorflow.python.ops.distributions.distribution import *
-from tensorflow.python.ops.distributions.exponential import Exponential
-from tensorflow.python.ops.distributions.gamma import Gamma
-from tensorflow.python.ops.distributions.kullback_leibler import *
-from tensorflow.python.ops.distributions.laplace import Laplace
-from tensorflow.python.ops.distributions.multinomial import Multinomial
-from tensorflow.python.ops.distributions.normal import Normal
-from tensorflow.python.ops.distributions.student_t import StudentT
-from tensorflow.python.ops.distributions.uniform import Uniform
-# pylint: enable=wildcard-import,unused-import
+# pylint: disable=wildcard-import,unused-import,g-import-not-at-top
+with deprecation.silence():
+ from tensorflow.python.ops.distributions.bernoulli import Bernoulli
+ from tensorflow.python.ops.distributions.beta import Beta
+ from tensorflow.python.ops.distributions.categorical import Categorical
+ from tensorflow.python.ops.distributions.dirichlet import Dirichlet
+ from tensorflow.python.ops.distributions.dirichlet_multinomial import DirichletMultinomial
+ from tensorflow.python.ops.distributions.distribution import *
+ from tensorflow.python.ops.distributions.exponential import Exponential
+ from tensorflow.python.ops.distributions.gamma import Gamma
+ from tensorflow.python.ops.distributions.kullback_leibler import *
+ from tensorflow.python.ops.distributions.laplace import Laplace
+ from tensorflow.python.ops.distributions.multinomial import Multinomial
+ from tensorflow.python.ops.distributions.normal import Normal
+ from tensorflow.python.ops.distributions.student_t import StudentT
+ from tensorflow.python.ops.distributions.uniform import Uniform
+# pylint: enable=wildcard-import,unused-import
+del deprecation