title: Weight sharing in Tensorflow
body: <p>I'm trying to implement the following architecture:<a href="https://i.stack.imgur.com/uobrz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uobrz.jpg" alt="Symmetric neural net layer"></a></p>
  
  <p>I'm passing a concatenated input</p>
  
  <pre><code>[x y] 
  </code></pre>
  
  <p>into a neural net and the fist layer needs to be symmetric in a way suggested in the image, with N_HIDDEN neurons in the layer. I started with the following setup:</p>
  
  <pre><code>input = tf.placeholder('float', [None, 2*NUM_FEATURES])
  weights = tf.Variable(tf.random_uniform(shape=[2*NUM_FEATURES, N_HIDDEN], minval=-0.0001, maxval=0.0001, dtype=tf.float32))
  
  hidden = tf.matmul(input,weights)
  </code></pre>
  
  <p>However, the above code is not symmetric in the way the image suggests.  If I make my weights only half the size, then I have to multiply the inputs x and y separately. </p>
  
  <pre><code>weights = tf.Variable(tf.random_uniform(shape=[NUM_FEATURES, N_HIDDEN], minval=-0.0001, maxval=0.0001, dtype=tf.float32))
  </code></pre>
  
  <p>What is the way in tensorflow to share the neuron for both x_k and y_k?</p>