Skip to content

Commit

Permalink
Add support for dlpack with numpy 1.23.0 (#284)
Browse files Browse the repository at this point in the history
Co-authored-by: Karl Higley <karlb@nvidia.com>
  • Loading branch information
oliverholworthy and karlhigley committed Apr 18, 2023
1 parent 80f0252 commit 6ab05ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions merlin/table/numpy_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ def _register_from_dlpack_cpu_to_numpy():
@_from_dlpack_cpu.register(np.ndarray)
def _from_dlpack_cpu_to_numpy(to, array):
try:
# private `_from_dlpack` method added in 1.22.0
return np._from_dlpack(array)
except AttributeError:
pass
try:
# public `from_dlpack` method added in 1.23.0
return np.from_dlpack(array)
except AttributeError as exc:
raise NotImplementedError(
"NumPy does not implement the DLPack Standard until version 1.22.0, "
Expand Down

0 comments on commit 6ab05ce

Please sign in to comment.