Skip to content

Commit a15c7bc

Browse files
committed
raise if (device_type, device_id) is not found in the DLPack mappings
1 parent df1574d commit a15c7bc

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

array_api_strict/_devices.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ def _normalize_dl_device(device_type: IntEnum | int, device_id: int) -> tuple[in
6262
def _device_from_dlpack_device(
6363
device_type: IntEnum | int, device_id: int
6464
) -> Device:
65-
return _DLPACK_DEVICE_TO_LOGICAL.get(
66-
_normalize_dl_device(device_type, device_id), CPU_DEVICE
67-
)
65+
# NB: if the (device_type, device_id) pair not known, raise
66+
return _DLPACK_DEVICE_TO_LOGICAL[_normalize_dl_device(device_type, device_id)]
6867

6968

7069
def check_device(device: Device | None) -> None:

0 commit comments

Comments
 (0)