title: Zero gradients for repetitve convolutions tensorflow?
body: <p>When I try to do repetitive convolution for same input, gradients become zero for more than 1 repetition. what could go wrong here? </p>
  
  <pre><code>W = tf.Variable(tf.zeros([3, 3, 1, 1]))
  output = input_image # a 4D tensor [batch_size, 16, 16, 1]
  for _ in range(4):
      output = tf.nn.conv2d(
          output, 
          W, 
          [1, 2, 2, 1], 
          padding="SAME"
      )
  
  preds = tf.reshape(output, shape=[batch_size])
  
  loss = tf.reduce_mean(preds, labels)
  
  # this gradient zero when num of repetitive layers &gt; 1??
  tf_gradient = tf.concat(0, tf.gradients(loss, W))
  gradient = session.run(tf_gradient)
  
  print(gradient.reshape(3**2))
  #prints [ 0.  0.  0.  0.  0.  0.  0.  0.  0.]
  </code></pre>