title: Tensorflow global_step TypeError
body: <p>I'm adding Tensorboard to an existing small Tensorflow project that I know works to practice working with Tensorboard but I get a type error that global_step must be a string or tensor, however I have assigned global_step to a <code>tf.Variable(0, name='global_step', trainable=False)</code> just like the documentation and every example I see online. Any idea of what I'm missing would be super appreciated. </p>
  
  
  
  <p>---> 70             [summary_merge, tf.train.global_step(sess, global_step_tensor) ,update_model, weights], feed_dict)</p>
  
  <p>TypeError: Fetch argument 0 has invalid type , must be a string or Tensor. (Can not convert a int into a Tensor or Operation.)</p>
  
  <pre class="lang-python prettyprint-override"><code>import gym
  import numpy as np
  import random
  import ipdb
  import matplotlib.pyplot as plt
  import tensorflow as tf
  %matplotlib inline
  
  tf.reset_default_graph()
  env = gym.make('FrozenLake-v0')
  
  global_step_tensor = tf.Variable(0, name='global_step', trainable=False)
  saver = tf.train.Saver()
  
  with tf.name_scope('policy-network'):
      observations = tf.placeholder(shape=[1, env.observation_space.n], dtype=tf.float32, name='input')
      weights = tf.Variable(tf.random_uniform([16,4], 0, 0.01))
      Qout = tf.matmul(observations, weights)
      predict = tf.argmax(Qout, 1)
  
      nextQ = tf.placeholder(shape=[1, 4], dtype=tf.float32)
      loss = tf.reduce_sum(tf.square(nextQ - Qout))
      trainer = tf.train.GradientDescentOptimizer(learning_rate=0.1)
      update_model = trainer.minimize(loss, global_step= global_step_tensor)
  
  with tf.name_scope('summaries'):
      summary_merge = tf.summary.merge([
          tf.summary.histogram('loss', loss),
          tf.summary.histogram('weights', weights)
      ])
  
  
  init = tf.global_variables_initializer()
  
  gamma = .99
  epsilon = 0.1
  num_episodes = 2000
  
  j_list = []
  r_list = []
  
  with tf.Session() as sess:
      # Create a writer for summary data
      writer = tf.summary.FileWriter('/tmp/display', sess.graph)
      sess.run(init)
      for i in range(num_episodes):
          s = env.reset()
          reward_all = 0
          done = False
          j = 0
  
          while j &lt; 99:
              j+= 1
  
              a, allQ = sess.run([predict, Qout], feed_dict={observations:np.identity(16)[s:s+1]})
              if np.random.rand(1) &lt; epsilon:
                  a[0] = env.action_space.sample()
  
              s1, reward, done, _ = env.step(a[0])
              Q1 = sess.run(Qout, feed_dict={observations: np.identity(16)[s1:s1+1]}) 
  
              maxQ1 = np.max(Q1)
              targetQ = allQ
  
              targetQ[0, a[0]] = reward + gamma*maxQ1
              feed_dict = {observations: np.identity(16)[s:s+1], nextQ:targetQ}
  
              # Run prediction operation, evaluate summary_merge and assign to summaries
              summaries, global_step_tensor, _, W1 = sess.run(
              [summary_merge, tf.train.global_step(sess, global_step_tensor) ,update_model, weights], feed_dict)
  
              # Write summaries to writer
              writer.add_summary(summaries, global_step)
  
              reward_all += reward
              s = s1
  
              if done == True:
                  epsilon = 1./((i/50) + 10)
                  break
  
          if (i+1) % 1000 == 0:
              # Save the graph every 1000 episodes
              saver.save(sess, '/tmp/checkpoint', global_step=global_step)
  
          j_list.append(j)
          r_list.append(reward_all)
  
  print("Percent of succesful episodes: {} %".format((sum(r_list)/num_episodes)))
  </code></pre>