title: Interactive Session in Tensorflow - different output for convolution operator
body: <p>I am new to tensorflow and I am having an issue with InteractiveSession.</p>
  
  <p>In the following code:</p>
  
  <pre><code>import tensorflow as tf
  
  def weight_variable(shape):
    initial = tf.random_uniform(shape, 0, 10, seed=1, dtype="int32")
    print("weights=\n",initial.eval())
    return tf.Variable(tf.to_float(initial))
  
  def conv2d(x, W):
    return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
  
  
  # first dimension: Number of examples to train on, 2nd and 3rd: example width and height, 
  # last one is: the number of channels 
  
  x = tf.to_float(tf.Variable([[[[1],     [4],    [5],    [6],    [7]],  
                               [[10],   [11],   [22],    [9],    [8]],  
                               [[24],   [25],   [20],   [21],   [19]],  
                               [[14],   [12],   [13],    [3],   [18]],  
                               [[15],   [16],   [19],   [18],   [17]]]])) # 1 example of 5x5 one channel image
  
  
  sess = tf.InteractiveSession()
  
  # The first two dimensions are the patch size, the next is the number of input channels, 
  # and the last is the number of output channels. 
  W_conv1 = weight_variable([2, 2, 1, 1]) #[3,3,3,64]
  
  conv = conv2d(x, W_conv1)
  
  
  sess.run(tf.initialize_all_variables())
  
  print(sess.run(conv))
  
  sess.close()
  </code></pre>
  
  <p>when I comment the line: </p>
  
  <pre><code>print("weights=\n",initial.eval())
  </code></pre>
  
  <p>I get different results when I print the convolution <code>print(sess.run(conv))</code>. I understand that keyword eval interacts with the session, but the way I understand is that it shall not change the output if I use it or not.</p>
  
  <p>Here is the output I get when using <code>initial.eval()</code>:</p>
  
  <blockquote>
    <p>[[[[7]]</p>
    
    <p>[[9]]]</p>
    
    <p>[[[3]]</p>
    
    <p>[[2]]]] [[[[ 156.]    [ 209.]    [ 278.]    [ 167.]    [  79.]]</p>
    
    <p>[[ 389.]    [ 472.]    [ 337.]    [ 319.]    [ 179.]]</p>
    
    <p>[[ 386.]    [ 332.]    [ 314.]    [ 254.]    [ 181.]]</p>
    
    <p>[[ 293.]    [ 317.]    [ 262.]    [ 360.]    [ 171.]]</p>
    
    <p>[[ 143.]    [ 168.]    [ 163.]    [ 154.]    [  17.]]]]</p>
  </blockquote>
  
  <p>and when I comment that line, I get:</p>
  
  <blockquote>
    <p>[[[[  95.]    [ 150.]    [ 173.]    [ 148.]    [  73.]]</p>
    
    <p>[[ 291.]    [ 390.]    [ 337.]    [ 236.]    [ 113.]]</p>
    
    <p>[[ 459.]    [ 417.]    [ 374.]    [ 363.]    [ 187.]]</p>
    
    <p>[[ 283.]    [ 287.]    [ 211.]    [ 271.]    [ 177.]]</p>
    
    <p>[[ 249.]    [ 283.]    [ 295.]    [ 279.]    [ 119.]]]]</p>
  </blockquote>
  
  <p>Note that the 156 changed to 95 and the rest of the output of the convolution. </p>