blei-lab / edward

A probabilistic programming language in TensorFlow. Deep generative models, variational inference.
http://edwardlib.org
Other
4.83k stars 759 forks source link

nd-array #883

Open bashhwu opened 6 years ago

bashhwu commented 6 years ago

Tthe following example considers mu and sigma as a scalar. what if they are arrays?

Create a mixture of two Gaussians:

tfd = tf.contrib.distributions mix = 0.3 bimix_gauss = tfd.Mixture( cat=tfd.Categorical(probs=[mix, 1.-mix]), components=[ tfd.Normal(loc=-1., scale=0.1), tfd.Normal(loc=+1., scale=0.5), ])

tfd.Normal(loc=-1., scale=0.1) accepts loc and scale to be arrays but when used inside the tfd.Mixture, an error message is generated ( Shapes () and (784, 400) must have the same rank)