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 ba2f76b commit 08a7e46Copy full SHA for 08a7e46
src/array_api_typing/_array.py
@@ -97,11 +97,26 @@ def mT(self) -> Self: # noqa: N802
97
...
98
99
100
+class HasNDim(Protocol):
101
+ """Protocol for array classes that have a number of dimensions attribute."""
102
+
103
+ @property
104
+ def ndim(self) -> int:
105
+ """Number of array dimensions (axes).
106
107
+ Returns:
108
+ int: number of array dimensions (axes).
109
110
+ """
111
+ ...
112
113
114
class Array(
115
# ------ Attributes -------
116
HasDType[DTypeT_co],
117
HasDevice,
118
HasMatrixTranspose,
119
+ HasNDim,
120
# ------- Methods ---------
121
HasArrayNamespace[NamespaceT_co],
122
# -------------------------
0 commit comments