title: Can not convert a function into a tensor or operation
body: <p>I am constantly getting an error for a convolutional network I'm building and I don't know why the error is popping up. Here's my network:</p>
  
  <pre><code>learning_rate = 0.0001
  epochs = 10
  batch_size = 128
  test_valid_size = 128
  n_classes = 5
  dropout = 0.75
  
  start1 = timer()
  
  with tf.device('/gpu:0'):
      weights = {
      'wc1': tf.Variable(tf.random_normal([5, 5, 1, 32])),
      'wc2': tf.Variable(tf.random_normal([5, 5, 32, 64])),
      'wd1': tf.Variable(tf.random_normal([7*7*64, 1024])),
      'out': tf.Variable(tf.random_normal([1024, n_classes]))}
      biases = {
      'bc1': tf.Variable(tf.random_normal([32])),
      'bc2': tf.Variable(tf.random_normal([64])),
      'bd1': tf.Variable(tf.random_normal([1024])),
      'out': tf.Variable(tf.random_normal([n_classes]))}
  
      x = tf.placeholder(tf.float32, [None, 80, 240, 1])
      y = tf.placeholder(tf.float32, [None, n_classes])
      keep_prob = tf.placeholder(tf.float32)
  
      layer_1 = tf.nn.conv2d(x, weights['wc1'], strides = [1, 1, 1, 1], padding = 'SAME')
      layer_1 = tf.nn.bias_add(layer_1, biases['bc1'])
      layer_1 = tf.nn.max_pool(layer_1, ksize = [1, 2, 2, 1], strides = [1, 2, 2, 1], padding = 'SAME')
  
      layer_2 = tf.nn.conv2d(layer_1, weights['wc2'], strides = [1, 1, 1, 1], padding = 'SAME')
      layer_2 = tf.nn.bias_add(layer_2, biases['bc2'])
      layer_2 = tf.nn.max_pool(layer_2, ksize = [1, 2, 2, 1], strides = [1, 2, 2, 1], padding = 'SAME')
  
      layer_3 = tf.reshape(layer_2, [-1, weights['wd1'].get_shape().as_list()[0]])
      layer_3 = tf.add(tf.matmul(layer_3, weights['wd1']), biases['bd1'])
      layer_3 = tf.nn.relu(layer_3)
      layer_3 = tf.nn.dropout(layer_3, dropout)
  
      logits = tf.add(tf.matmul(layer_3, weights['out']), biases['out'])
  
      cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits = logits, labels = y))
      optimizer = tf.train.GradientDescentOptimizer(learning_rate = learning_rate).minimize(cost)
  
      correct_pred = tf.equal(tf.argmax(logits, 1), tf.argmax(y, 1))
      accuracy = tf.reduce_mean(tf.cast(correct_pred, tf.float32))   
  
  init = tf.global_variables_initializer
  
  save_file_2 = './train_model2.ckpt'
  saver = tf.train.Saver()
  
  with tf.Session() as sess:
      sess.run(init)
  
      for epoch in range(epochs):
          for batch_features, batch_labels in batches(batch_size, count_X_train, count_y_train):
              sess.run(optimizer, feed_dict = {x:batch_features, y:batch_labels, keep_prob:dropout})
  
      saver.save(sess, save_file_2)
      print("")
      print("trained model_2 saved")
  
      test_acc = sess.run(accuracy, feed_dict = {x: count_X_test[:test_valid_size], y: count_y_test[:test_valid_size], keep_prob:1.})
      print('Testing Accuracy: {}'.format(test_acc))
  
  
  end1 = timer()
  print("time:", str(end1 - start1))
  </code></pre>
  
  <p>Somewhere in the code, I guess sess.run(init) is giving me the following error:</p>
  
  <pre><code>TypeError: Fetch argument &lt;function global_variables_initializer at 0x00000224FD81FD90&gt; has invalid type &lt;class 'function'&gt;, must be a string or Tensor. (Can not convert a function into a Tensor or Operation.)
  </code></pre>
  
  <p>Any idea where this error might be coming from? Thanks!</p>