【发布时间】:2019-02-11 13:47:23
【问题描述】:
我正在尝试使用 tensorflow-probability 并从一些非常简单的东西开始:
import tensorflow as tf
import tensorflow_probability as tfp
tf.enable_eager_execution()
tfd = tfp.distributions
poiss = tfd.Poisson(0.8)
poiss.sample(2, seed=1)
#> Out: <tf.Tensor: id=3569, shape=(2,), dtype=float32, numpy=array([0., 0.], dtype=float32)>
poiss.sample(2, seed=1)
#> Out: <tf.Tensor: id=3695, shape=(2,), dtype=float32, numpy=array([1., 0.], dtype=float32)>
poiss.sample(2, seed=1)
#> Out: <tf.Tensor: id=3824, shape=(2,), dtype=float32, numpy=array([2., 2.], dtype=float32)>
poiss.sample(2, seed=1)
#> Out: <tf.Tensor: id=3956, shape=(2,), dtype=float32, numpy=array([0., 1.], dtype=float32)>
我以为重复使用相同的种子会得到相同的结果,但不知何故,这不是真的。
我也尝试过不执行eager,但结果仍然无法重现。如果我添加 tf.set_random_seed(12) 之类的内容,也是同样的情况。
我想我缺少一些基本的东西?
对于那些感兴趣的人,我在 Ubuntu 16.04 上运行 Python 3.5.2 与
张量流概率==0.5.0
张量流==1.12.0
【问题讨论】:
标签: tensorflow random tensorflow-probability