How can I initialize variables in TensorFlow?
I want to associate each weight with a Bernoulli distribution:
- with probability of p to get some value x1, and
- with probability of 1-p to get some value x2.
How should I initialize this matrix?
I wrote this code:
logits_y = tf.get_variable("logits", [n_input*n_hidden,2],
initializer=tf.constant_initializer(1.))
The 2
in [n_input*n_hidden, 2]
means [p, 1-p]
.
I'm not sure what exactly you plan to do with your matrix, but here's how you can generate Bernoulli distribution in tensorflow: