tensorflow1.4.1版本没有tensorflow.contrib.distributions
在 TensorFlow 1.4.1 中,我的python版本是2.7.18。然后将代码中的引用全部改一遍。并修改代码以使用该包。
·
我的python版本是2.7.18
在 TensorFlow 1.4.1 中,tensorflow.contrib.distributions 模块已经被移动到 tensorflow_probability 包中。你可以安装 tensorflow_probability 并修改代码以使用该包。
pip install tensorflow-probability==0.4.0
注意要是这个版本,不然会安装报错如下:
然后将代码中的引用全部改一遍
# 原代码
import tensorflow.contrib.distributions as tfd
# 修改后的代码
import tensorflow_probability as tfp
tfd = tfp.distributions
不行的话还有一法(我采用此法)。
from scipy import stats as ds
更多推荐



所有评论(0)