File tree Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 6
6
"HasDType" ,
7
7
"HasDevice" ,
8
8
"HasMatrixTranspose" ,
9
+ "HasNDim" ,
9
10
"__version__" ,
10
11
"__version_tuple__" ,
11
12
)
16
17
HasDevice ,
17
18
HasDType ,
18
19
HasMatrixTranspose ,
20
+ HasNDim ,
19
21
)
20
22
from ._version import version as __version__ , version_tuple as __version_tuple__
Original file line number Diff line number Diff line change 4
4
"HasDType" ,
5
5
"HasDevice" ,
6
6
"HasMatrixTranspose" ,
7
+ "HasNDim" ,
7
8
)
8
9
9
10
from types import ModuleType
@@ -100,6 +101,20 @@ def mT(self) -> Self: # noqa: N802
100
101
...
101
102
102
103
104
+ class HasNDim (Protocol ):
105
+ """Protocol for array classes that have a number of dimensions attribute."""
106
+
107
+ @property
108
+ def ndim (self ) -> int :
109
+ """Number of array dimensions (axes).
110
+
111
+ Returns:
112
+ int: number of array dimensions (axes).
113
+
114
+ """
115
+ ...
116
+
117
+
103
118
class Array (
104
119
# ------ Attributes -------
105
120
HasDType [DTypeT_co ],
Original file line number Diff line number Diff line change @@ -53,6 +53,13 @@ _: xpt.HasMatrixTranspose = nparr
53
53
_ : xpt .HasMatrixTranspose = nparr_i32
54
54
_ : xpt .HasMatrixTranspose = nparr_f32
55
55
56
+ # =========================================================
57
+ # `xpt.HasNDim`
58
+
59
+ _ : xpt .HasNDim = nparr
60
+ _ : xpt .HasNDim = nparr_i32
61
+ _ : xpt .HasNDim = nparr_f32
62
+
56
63
# =========================================================
57
64
# `xpt.Array`
58
65
Original file line number Diff line number Diff line change @@ -61,6 +61,14 @@ _: xpt.HasMatrixTranspose = nparr_i32
61
61
_ : xpt .HasMatrixTranspose = nparr_f32
62
62
_ : xpt .HasMatrixTranspose = nparr_b
63
63
64
+ # =========================================================
65
+ # `xpt.HasNDim`
66
+
67
+ _ : xpt .HasNDim = nparr
68
+ _ : xpt .HasNDim = nparr_i32
69
+ _ : xpt .HasNDim = nparr_f32
70
+ _ : xpt .HasNDim = nparr_b
71
+
64
72
# =========================================================
65
73
# `xpt.Array`
66
74
You can’t perform that action at this time.
0 commit comments