Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion array_api_tests/dtype_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,13 @@ def is_device_dlpack_compatible(device):
"""If device is dlpack compatible, return True, else False"""
# XXX: there seems to be no better way than try-catch for __dlpack_device__()

x = xp.empty(2, device=device)
try:
x = xp.empty(2, device=device)
Comment thread
prady0t marked this conversation as resolved.
except TypeError:
# array library does not have a device= argument, try without
# NB: we cannot use inspect.signature because e.g. torch
# functions don't work with inspect
x = xp.empty(2)
Comment thread
prady0t marked this conversation as resolved.
try:
x.__dlpack_device__()
except:
Expand Down
Loading