class_docstr: Wraps a custom device which attempts to propagate tensor layouts.
class_docstr_tok: ["Wraps","a","custom","device","which","attempts","to","propagate","tensor","layouts","."]
docstr: Unpacks a DTensor handle on this DTensor device.
  
  Packing and unpacking are inverse operations:
  
  ```
  * unpack(pack(tensors)) == tensors
  * pack(unpack(dtensor)) == dtensor
  ```
  
  Refer to `dtensor.unpack` for more information.
  
  Args:
    dtensor: The DTensor to unpack.
  
  Returns:
    The raw underlying tensor components of the DTensor.
  
  Raises:
    RuntimeError: When not called eagerly.
docstr_tok: ["Unpacks","a","DTensor","handle","on","this","DTensor","device",".","Packing","and","unpacking","are","inverse","operations",":","``","`","*","unpack","(","pack","(","tensors",")",")","==","tensors","*","pack","(","unpack","(","dtensor",")",")","==","dtensor","``","`","Refer","to","`","dtensor.unpack","`","for","more","information",".","Args",":","dtensor",":","The","DTensor","to","unpack",".","Returns",":","The","raw","underlying","tensor","components","of","the","DTensor",".","Raises",":","RuntimeError",":","When","not","called","eagerly","."]
code: def unpack(self, dtensor: Any) -> Sequence[Any]:
      """Unpacks a DTensor handle on this DTensor device.
  
      Packing and unpacking are inverse operations:
  
      ```
      * unpack(pack(tensors)) == tensors
      * pack(unpack(dtensor)) == dtensor
      ```
  
      Refer to `dtensor.unpack` for more information.
  
      Args:
        dtensor: The DTensor to unpack.
  
      Returns:
        The raw underlying tensor components of the DTensor.
  
      Raises:
        RuntimeError: When not called eagerly.
      """
      if not context.executing_eagerly():
          raise RuntimeError("`unpack` must be called eagerly.")
      try:
          tensors = _pywrap_dtensor_device.Unpack(
              context.context()._handle,  # pylint: disable=protected-access
              dtensor,
              self._device_info,
          )
      except (
          core._NotOkStatusException
      ) as e:  # pylint: disable=protected-access
          raise core._status_to_exception(
              e
          ) from None  # pylint: disable=protected-access
  
      is_sparse = _pywrap_dtensor_device.IsSparseDTensor(
          context.context()._handle,  # pylint: disable=protected-access.
          dtensor,
          self._device_info,
      )
      if is_sparse:
          result = []
          for i in range(len(tensors) // 3):
              result.append(
                  sparse_tensor.SparseTensor(
                      tensors[i],
                      tensors[i + len(tensors) // 3],
                      tensors[i + 2 * len(tensors) // 3],
                  )
              )
          return result
      else:
          return tensors
  
imports: import contextlib
  import logging
  import threading
  from typing import Any, List, Sequence, Set
  import numpy
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.dtensor.python import config
  from tensorflow.dtensor.python import layout
  from tensorflow.python import _pywrap_dtensor_device
  from tensorflow.python.eager import context
  from tensorflow.python.eager import core
  from tensorflow.python.framework import device
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.util import _pywrap_utils
label_desc: Use image node_id 6 for calling the DTensorDevice obj's underlying member method code with example usage: obj.unpack(dtensor) and returns: result, tensors