parameters: (self, dtype=None, name=None, as_ref=False)
docstring: Converts a variable to a tensor.
docstring_summary: Converts a variable to a tensor.
docstring_tokens: Converts a variable to a tensor .
function: def _dense_var_to_tensor(self, dtype=None, name=None, as_ref=False):
      """Converts a variable to a tensor."""
      # pylint: disable=protected-access
      if _enclosing_tpu_context() is None:
        return super(TPUVariableMixin, self)._dense_var_to_tensor(
            dtype=dtype, name=name, as_ref=as_ref)
      # pylint: enable=protected-access
      elif dtype is not None and dtype != self.dtype:
        return math_ops.cast(self.read_value(), dtype)
      else:
        return self.handle if as_ref else self.read_value()
function_tokens: def _dense_var_to_tensor ( self , dtype = None , name = None , as_ref = False ) : # pylint: disable=protected-access if _enclosing_tpu_context ( ) is None : return super ( TPUVariableMixin , self ) . _dense_var_to_tensor ( dtype = dtype , name = name , as_ref = as_ref ) # pylint: enable=protected-access elif dtype is not None and dtype != self . dtype : return math_ops . cast ( self . read_value ( ) , dtype ) else : return self . handle if as_ref else self . read_value ( )