Search code examples
pythontensorflowtensorflow-probability

Tensorflow linear operator graph parents warning


I am working with tensorflow and the multivariate gaussian distribution implementation of tensorflow-probability to shape distributions (in the context of normalizing flows).

I just want to do a mixture of gaussians, and my code raises a deprecation warning whose origin is unknown.

The warning is the following:

WARNING: Logging before flag parsing goes to stderr.
W0413 18:11:48.598939 4476009920 deprecation.py:506] From /Users/Ashitaka2/.virtualenvs/deep_learning/lib/python3.7/site-packages/tensorflow_core/python/ops/linalg/linear_operator_diag.py:166: calling LinearOperator.__init__ (from tensorflow.python.ops.linalg.linear_operator) with graph_parents is deprecated and will be removed in a future version.
Instructions for updating:
Do not pass `graph_parents`.  They will  no longer be used.

which does not help me at all.

I am pretty sure that this block of code is the one causing the warning to be raised:

mu1 = 0.35 * np.array([-1,-1], dtype='float32')
mu2 = 0.35 * np.array([1,1], dtype='float32')
scale = 0.1 * np.array([1,1], dtype='float32')
pi = 0.5
comp1 = tfd.MultivariateNormalDiag(loc=mu1, scale_diag=scale)
comp2 = tfd.MultivariateNormalDiag(loc=mu2, scale_diag=scale)
return (1-pi)*comp1.prob(z) + pi*comp2.prob(z)

Any idea as to what causes that warning and how can it be solved?

I googled the warning and could not find anything relevant. Thanks!


Solution

  • Can you say what versions of TF and TFP you have? print(tf.__version__, tfp.__version__). I think these warnings should not be present in the latest versions.