class_docstr: Holds a packed distributed variable and a device.
class_docstr_tok: ["Holds","a","packed","distributed","variable","and","a","device","."]
code: def __getattr__(self, name):
      # Exceptions raised inside the contextmanager can cause a reference
      # cycle.[1] The cycle involves the current frame, which holds the reference
      # to the outer frame. Tensorflow, e.g. iterators, relies on object
      # finalizers to clean up resources. Such references prevents the resource
      # from being deleted and can cause leaks and errors. One corner the case is
      # that iterators are kept alive and the garbage collector happens to run
      # after auto control dependencies; this causes the deletion to lose the
      # control dependencies to operations that uses such resources.
      #
      # Catch and re-raise the exception seems to workaround the issue.
      #
      # [1] https://bugs.python.org/issue43533
      try:
          with ops.device(self._device):
              return getattr(self._var, name)
      except:  # pylint: disable=try-except-raise
          raise
  
imports: from tensorflow.python.distribute import device_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 math_ops
  from tensorflow.python.ops import resource_variable_ops
label_desc: Use image node_id 2 for calling the PackedVarAndDevice obj's underlying member method code with example usage: obj.__getattr__(name) and returns: getattr