title: How to dereference _ref tensor type in TensorFlow?
body: <p>How to convert reference tensor type to value tensor type?</p>
  
  <p>The only way I found is to add a zero to a tensor. Is there any convenient way?</p>
  
  <p>Below <code>assign</code> is a tensor of reference type. How to get rid of <code>_ref</code>?</p>
  
  <pre><code>import tensorflow as tf
  
  counter = tf.Variable(0, name="counter")
  
  zero = tf.constant(0)
  one = tf.constant(1)
  
  new_counter = tf.add(counter, one)
  assign = tf.assign(counter, new_counter) # dtype=int32_ref
  result = tf.add(assign, zero) # dtype=int32
  result2 = tf.convert_to_tensor(assign) # dtype=int32_ref
  # result3 = assign.value() # has no attribute value
  </code></pre>