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 9ed041b commit 859664aCopy full SHA for 859664a
src/array_api_typing/_array.py
@@ -92,12 +92,27 @@ def mT(self) -> Self: # noqa: N802
92
...
93
94
95
+class HasNDim(Protocol):
96
+ """Protocol for array classes that have a number of dimensions attribute."""
97
+
98
+ @property
99
+ def ndim(self) -> int:
100
+ """Number of array dimensions (axes).
101
102
+ Returns:
103
+ int: number of array dimensions (axes).
104
105
+ """
106
+ ...
107
108
109
@docstring_setter(**_array_docstrings)
110
class Array(
111
# ------ Attributes -------
112
HasDType[DType_co],
113
HasDevice,
114
HasMatrixTranspose,
115
+ HasNDim,
116
# ------ Methods -------
117
HasArrayNamespace[NS_co],
118
op.CanPosSelf,
0 commit comments