Skip to content

Commit c1e942b

Browse files
committed
Add review changes
1 parent 503cf82 commit c1e942b

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

spec/API_specification/signatures/array_object.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ def __init__(self) -> None:
66
Initialize the attributes for the array object class.
77
"""
88

9-
self.dtype = None
9+
@property
10+
def dtype() -> dtype:
1011
"""
1112
Data type of the array elements.
1213
@@ -16,7 +17,8 @@ def __init__(self) -> None:
1617
array data type.
1718
"""
1819

19-
self.device = None
20+
@property
21+
def device() -> device:
2022
"""
2123
Hardware device the array data resides on.
2224
@@ -26,7 +28,8 @@ def __init__(self) -> None:
2628
a ``device`` object (see :ref:`device-support`).
2729
"""
2830

29-
self.mT = None
31+
@property
32+
def mT() -> array:
3033
"""
3134
Transpose of a matrix (or a stack of matrices).
3235
@@ -38,7 +41,8 @@ def __init__(self) -> None:
3841
array whose last two dimensions (axes) are permuted in reverse order relative to original array (i.e., for an array instance having shape ``(..., M, N)``, the returned array must have shape ``(..., N, M)``). The returned array must have the same data type as the original array.
3942
"""
4043

41-
self.ndim = None
44+
@property
45+
def ndim() -> int:
4246
"""
4347
Number of array dimensions (axes).
4448
@@ -48,7 +52,8 @@ def __init__(self) -> None:
4852
number of array dimensions (axes).
4953
"""
5054

51-
self.shape = None
55+
@property
56+
def shape() -> Tuple[Optional[int], ...]:
5257
"""
5358
Array dimensions.
5459
@@ -64,7 +69,8 @@ def __init__(self) -> None:
6469
- The returned value should be a tuple; however, where warranted, an array library may choose to return a custom shape object. If an array library returns a custom shape object, the object must be immutable, must support indexing for dimension retrieval, and must behave similarly to a tuple.
6570
"""
6671

67-
self.size = None
72+
@property
73+
def size() -> Optional[int]:
6874
"""
6975
Number of elements in an array.
7076
@@ -80,7 +86,8 @@ def __init__(self) -> None:
8086
- For array libraries having graph-based computational models, an array may have unknown dimensions due to data-dependent operations.
8187
"""
8288

83-
self.T = None
89+
@property
90+
def T() -> array:
8491
"""
8592
Transpose of the array.
8693
@@ -939,4 +946,4 @@ def to_device(self: array, device: device, /, *, stream: Optional[Union[int, Any
939946
Notes
940947
-----
941948
- If ``stream`` is given, the copy operation should be enqueued on the provided ``stream``; otherwise, the copy operation should be enqueued on the default stream/queue. Whether the copy is performed synchronously or asynchronously is implementation-dependent. Accordingly, if synchronization is required to guarantee data safety, this must be clearly explained in a conforming library's documentation.
942-
"""
949+
"""

0 commit comments

Comments
 (0)