code: def feed_ndarray(dali_tensor, arr, cuda_stream=None):
      """
      Copy contents of DALI tensor to MXNet's NDArray.
  
      Parameters
      ----------
      `dali_tensor` : nvidia.dali.backend.TensorCPU or nvidia.dali.backend.TensorGPU
                      Tensor from which to copy
      `arr` : mxnet.nd.NDArray
              Destination of the copy
      `cuda_stream` : cudaStream_t handle or any value that can be cast to cudaStream_t.
                      CUDA stream to be used for the copy
                      (if not provided, an internal user stream will be selected)
                      In most cases, using the default internal user stream or stream 0
                      is expected.
      """
      dali_type = types.to_numpy_type(dali_tensor.dtype)
  
      assert dali_type == arr.dtype, (
          "The element type of DALI Tensor/TensorList"
          " doesn't match the element type of the target MXNet "
          "NDArray: {} vs {}".format(dali_type, np.dtype(arr.dtype))
      )
  
      # Wait until arr is no longer used by the engine
      _wait_to_write(arr)
      assert dali_tensor.shape() == list(arr.shape), (
          "Shapes do not match: DALI tensor has "
          "shape {0}, but NDArray has shape {1}".format(
              dali_tensor.shape(), list(arr.shape)
          )
      )
      # Get CTypes void pointer to the underlying memory held by arr
      ptr = ctypes.c_void_p()
      mx.base._LIB.MXNDArrayGetData(arr.handle, ctypes.byref(ptr))
  
      cuda_stream = types._raw_cuda_stream(cuda_stream)
  
      # Copy data from DALI tensor to ptr
      if isinstance(dali_tensor, (TensorGPU, TensorListGPU)):
          stream = (
              None
              if cuda_stream is None
              else ctypes.c_void_p(cuda_stream)
          )
          dali_tensor.copy_to_external(ptr, stream, non_blocking=True)
      else:
          dali_tensor.copy_to_external(ptr)
  
imports: from nvidia.dali.backend import TensorGPU, TensorListGPU
  from nvidia.dali import types
  from nvidia.dali.plugin.base_iterator import _DaliBaseIterator
  from nvidia.dali.plugin.base_iterator import LastBatchPolicy
  import mxnet
  import ctypes
  import numpy
  from collections.abc import Iterable
label_desc: Use image node_id 2 for calling a global function with example usage: feed_ndarray(dali_tensor, arr, cuda_stream) without return types