【问题标题】:Tensorflow linear operator graph parents warningTensorflow线性算子图父母警告
【发布时间】:2020-07-26 06:19:43
【问题描述】:

我正在使用tensorflowtensorflow-probability 的多元高斯分布实现来塑造分布(在标准化流的背景下)。

我只想混合高斯,我的代码引发了一个来源未知的弃用警告。

警告如下:

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.

这对我一点帮助都没有。

我很确定这段代码是引发警告的代码块:

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)

关于导致该警告的原因以及如何解决它的任何想法?

我用谷歌搜索了警告,但找不到任何相关信息。谢谢!

【问题讨论】:

    标签: python tensorflow tensorflow-probability


    【解决方案1】:

    你能说一下你有哪些版本的 TF 和 TFP? print(tf.__version__, tfp.__version__)。 我认为这些警告不应该出现在最新版本中。

    【讨论】:

    • 嗨,Brian,我有 tensorflow 2.1.0 和 tensorflow_probability 0.9.0
    • 好吧,我猜他们可能只是从 tf-nightly/tfp-nightly 中消失了。无论如何,虽然我承认很烦人,但它是无害的。警告可能在 tf.linalg.LinearOperator 中,由 tfd.MultivariateNormalLinearOperator 引起,它是 MVNDiag 的超类。
    猜你喜欢
    • 2021-12-27
    • 1970-01-01
    • 1970-01-01
    • 2020-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-31
    • 2017-07-16
    相关资源
    最近更新 更多