class_docstr: Represents variables that are replicated.
  
  It behaves exactly as a normal variable, but uses corresponding variable
  handle based on the context.
  - In each replica, it uses the handle from that replica.
  - In tpu.replicate(), it uses the replicated handle.
  - Otherwise, it uses the handle from the primary replica.
  
  Note that it doesn't synchronize automatically as the old DistributedVariable
  in values.py.
class_docstr_tok: ["Represents","variables","that","are","replicated",".","It","behaves","exactly","as","a","normal","variable",",","but","uses","corresponding","variable","handle","based","on","the","context",".","-","In","each","replica",",","it","uses","the","handle","from","that","replica",".","-","In","tpu.replicate","(",")",",","it","uses","the","replicated","handle",".","-","Otherwise",",","it","uses","the","handle","from","the","primary","replica",".","Note","that","it","does","n't","synchronize","automatically","as","the","old","DistributedVariable","in","values.py","."]
code: def _device_scope(self):
      if (
          self._packed_handle is None
          or values_util.is_saving_non_distributed()
          or tpu_util.enclosing_tpu_context() is not None
      ):
          return ops.NullContextmanager()
      device = device_util.canonicalize(device_util.current())
      if device in self._device_to_handle:
          return ops.NullContextmanager()
      return ops.device(self._primary_handle.device)
  
imports: import copy
  import weakref
  from tensorflow.python.distribute import device_util
  from tensorflow.python.distribute import tpu_util
  from tensorflow.python.distribute import values_util
  from tensorflow.python.eager import context
  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 resource_variable_ops
  from tensorflow.python.ops import variables
label_desc: Use image node_id 6 for calling the DistributedVariable obj's underlying member method code with example usage: obj._device_scope() and returns: ops, ops, ops