class_docstr: A replicated variable for use on TPUs.
  
  When accessed inside a tpu.replicate() context, this variable acts as if it
  is a single variable whose handle is a replicated input to the computation.
  
  Outside a tpu.replicate() context currently this object has pretty murky
  semantics, especially with respect to things such as
  * initialization
  * colocation.
  
  TODO(phawkins): merge this with the TPU DistributionStrategy code.
docstr: Converts a variable to a tensor.
docstr_tok: ["Converts","a","variable","to","a","tensor","."]
code: 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:
          if hasattr(self._primary_var, "_dense_var_to_tensor"):
              return self._primary_var._dense_var_to_tensor(
                  dtype, name, as_ref
              )
          else:
              return ops.convert_to_tensor(self._primary_var)
      # pylint: enable=protected-access
      if dtype is not None and dtype != self.dtype:
          return NotImplemented
      if as_ref:
          return self.handle
      else:
          return self.read_value()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import contextlib
  import inspect
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_conversion_registry
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import gen_resource_variable_ops
label_desc: Use image node_id 23 for calling the ReplicatedVariable obj's underlying member method code with example usage: obj._dense_var_to_tensor(dtype, name, as_ref) and returns: NotImplemented, self, self, self, ops