We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 930abe8 commit 8b127fcCopy full SHA for 8b127fc
src/array_api_typing/_array.py
@@ -62,10 +62,20 @@ def dtype(self) -> DType_co:
62
...
63
64
65
+class HasDevice(Protocol):
66
+ """Protocol for array classes that have a device attribute."""
67
+
68
+ @property
69
+ def device(self) -> object: # TODO: more specific type
70
+ """Hardware device the array data resides on."""
71
+ ...
72
73
74
@docstring_setter(**_array_docstrings)
75
class Array(
76
# ------ Attributes -------
77
HasDType[DType_co],
78
+ HasDevice,
79
# ------ Methods -------
80
HasArrayNamespace[NS_co],
81
op.CanPosSelf,
0 commit comments