Skip to content

Commit aa6c89c

Browse files
authored
Add guidance requiring support for zero-dimensional arrays (#315)
1 parent f4c8c7f commit aa6c89c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/API_specification/array_object.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ A conforming implementation of the array API standard must provide and support a
1313
- Unless stated otherwise, methods must adhere to the type promotion rules defined in {ref}`type-promotion`.
1414
- Unless stated otherwise, floating-point operations must adhere to IEEE 754-2019.
1515

16+
Furthermore, a conforming implementation of the array API standard must support array objects of arbitrary rank `N` (i.e., number of dimensions), where `N` is greater than or equal to zero.
17+
18+
```{note}
19+
Conforming implementations must support zero-dimensional arrays.
20+
21+
Apart from array object attributes, such as `ndim`, `device`, and `dtype`, all operations in this standard return arrays (or tuples of arrays), including those operations, such as `mean`, `var`, and `std`, from which some common array libraries (e.g., NumPy) return scalar values.
22+
23+
_Rationale: always returning arrays is necessary to (1) support accelerator libraries where non-array return values could force device synchronization and (2) support delayed execution models where an array represents a future value._
24+
```
25+
1626
* * *
1727

1828
(operators)=

0 commit comments

Comments
 (0)