title: How can I initialize variables with Bernoulli distribution in TensorFlow?
body: <p>How can I initialize variables in TensorFlow?</p>
  
  <p>I want to associate each weight with a Bernoulli distribution:</p>
  
  <ul>
  <li>with probability of p to get some value x1, and </li>
  <li>with probability of 1-p to get some value x2. </li>
  </ul>
  
  <p>How should I initialize this matrix? </p>
  
  <p>I wrote this code:</p>
  
  <pre><code>logits_y = tf.get_variable("logits", [n_input*n_hidden,2],
                             initializer=tf.constant_initializer(1.))
  </code></pre>
  
  <p>The <code>2</code> in <code>[n_input*n_hidden, 2]</code> means <code>[p, 1-p]</code>.</p>