title: How to use a tensorflow tensor value in a formula?
body: <p>I have a quick question. I am developing a model in tensorflow, and need to use the iteration number in a formula during the construction phase. I know how to use global_step, but I am not using an already existing optimizer. 
  I am calculating my own gradients with</p>
  
  <pre><code>grad_W, grad_b = tf.gradients(xs=[W, b], ys=cost)
  grad_W = grad_W +rnd.normal(0,1.0/(1+epoch)**0.55)
  </code></pre>
  
  <p>and then using</p>
  
  <pre><code>new_W = W.assign(W - learning_rate * (grad_W))
  new_b = b.assign(b - learning_rate * (grad_b))
  </code></pre>
  
  <p>and would like to use the epoch value in the formula before updating my weights. How can I do it in the best way possible? I have a sess.run() part and would like to pass to the model the epoch number, but cannot directly use a tensor.
  From my run call</p>
  
  <pre><code>_, _, cost_ = sess.run([new_W, new_b ,cost], 
        feed_dict = {X_: X_train_tr, Y: labels_, learning_rate: learning_r})
  </code></pre>
  
  <p>I would like to pass the epoch number. How do you usually do it?</p>
  
  <p>Thanks in advance, Umberto</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>Thanks for the hints. So seems to work</p>
  
  <pre><code>grad_W = grad_W + tf.random_normal(grad_W.shape, 
        0.0,1.0/tf.pow(0.01+tf.cast(epochv, tf.float32),0.55))
  </code></pre>
  
  <p>but I still have to see if that is what I need and if is working as intended. Ideas and Feedback would be great!</p>