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

BNN: Bernoulli variational posterior approximation #897

Open BelhalK opened 6 years ago

BelhalK commented 6 years ago

I am trying to implement a Bayesian Neural network with Bernoulli posterior approximations but can not find a way to define the shape of my Bernoulli variable to be a matrix of size D=784 (input layer) and P=50 (first hidden layer). The Gaussian Posterior approximations code would be

qw0 = Normal(loc=tf.Variable(tf.random_normal([D,P])),scale=tf.nn.softplus(tf.Variable(tf.random_normal([D, P]))))

Any idea on how to adapt this for Bernoulli distribution?

Thanks!