ak.from_dlpack#

Defined in awkward.operations.ak_from_dlpack on line 16.

ak.from_dlpack(array, *, prefer_cpu=True, regulararray=False, highlevel=True, behavior=None, primitive_policy='error', attrs=None)#
Parameters:
  • array (cp.ndarray) – The DLPack-supporting array to convert into an Awkward Array.

  • prefer_cpu (bool) – If True, and the array device supports both CPU and GPU backends, prefer the CPU; otherwise, prefer the GPU.

  • regulararray (bool) – If True and the array is multidimensional, the dimensions are represented by nested ak.contents.RegularArray nodes; if False and the array is multidimensional, the dimensions are represented by a multivalued ak.contents.NumpyArray.shape. If the array is one-dimensional, this has no effect.

  • highlevel (bool) – If True, return an ak.Array; otherwise, return a low-level ak.contents.Content subclass.

  • behavior (None or dict) – Custom ak.behavior for the output array, if high-level.

  • attrs (None or dict) – Custom attributes for the output array, if high-level.

Converts a DLPack-aware array into an Awkward Array.

The resulting layout may involve the following ak.contents.Content types (only):