code: def test_tensor_expose_dlpack_capsule():
      # TODO(awolant): Numpy versions for Python 3.6 and 3.7 do not
      # support from_dlpack. When we upgrade DLPack support for DALI
      # this test needs to be changed.
      if not hasattr(np, "from_dlpack"):
          raise SkipTest("Test requires Numpy DLPack support.")
  
      arr = np.arange(20)
      tensor = TensorCPU(arr, "NHWC")
  
      capsule = tensor._expose_dlpack_capsule()
  
      # TODO(awolant): This adapter is required due to various implementations
      # for DLPack interface. When we extend DLPack export support this should
      # be removed.
      class dlpack_interface_adapter:
          def __init__(self, capsule):
              self.capsule = capsule
  
          def __dlpack__(self):
              return self.capsule
  
      arr_from_dlapck = np.from_dlpack(
          dlpack_interface_adapter(capsule)
      )
  
      assert np.array_equal(arr, arr_from_dlapck)
  
imports: import numpy
  import nvidia.dali.fn
  import nvidia.dali.types
  import warnings
  from numpy.testing import assert_array_equal
  from nvidia.dali import pipeline_def
  from nvidia.dali.backend_impl import TensorCPU, TensorListCPU, TensorListGPU
  from nvidia.dali.backend_impl import types
  import nvidia.dali
  from nose_utils import assert_raises
  from nose import SkipTest
  from test_utils import dali_type_to_np, py_buffer_from_address, get_device_memory_info
label_desc: Use image node_id 36 for calling a global function with example usage: test_tensor_expose_dlpack_capsule() and returns: self