Skip to content

Commit cbb1eb3

Browse files
authored
Specify output array data types (#57)
1 parent f8a9f2d commit cbb1eb3

10 files changed

+122
-105
lines changed

spec/API_specification/creation_functions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Returns evenly spaced values within the half-open interval `[start, stop)` as a
3333

3434
- **dtype**: _Optional\[ <dtype> ]_
3535

36-
- output array data type. Default: `None`.
36+
- output array data type. If `dtype` is `None`, the output array data type must be the default floating-point data type. Default: `None`.
3737

3838
#### Returns
3939

@@ -53,7 +53,7 @@ Returns an uninitialized array having a specified `shape`.
5353

5454
- **dtype**: _Optional\[ <dtype> ]_
5555

56-
- output array data type. Default: `None`.
56+
- output array data type. If `dtype` is `None`, the output array data type must be the default floating-point data type. Default: `None`.
5757

5858
#### Returns
5959

@@ -101,7 +101,7 @@ Returns a two-dimensional array with ones on the `k`th diagonal and zeros elsewh
101101

102102
- **dtype**: _Optional\[ <dtype> ]_
103103

104-
- output array data type. Default: `None`.
104+
- output array data type. If `dtype` is `None`, the output array data type must be the default floating-point data type. Default: `None`.
105105

106106
#### Returns
107107

@@ -125,7 +125,7 @@ Returns a new array having a specified `shape` and filled with `fill_value`.
125125

126126
- **dtype**: _Optional\[ <dtype> ]_
127127

128-
- output array data type. Default: `None`.
128+
- output array data type. If `dtype` is `None`, the output array data type must be the default floating-point data type. Default: `None`.
129129

130130
#### Returns
131131

@@ -179,7 +179,7 @@ Returns evenly spaced numbers over a specified interval.
179179

180180
- **dtype**: _Optional\[ <dtype> ]_
181181

182-
- output array data type. Default: `None`.
182+
- output array data type. If `dtype` is `None`, the output array data type must be the default floating-point data type. Default: `None`.
183183

184184
- **endpoint**: _Optional\[ bool ]_
185185

@@ -203,7 +203,7 @@ Returns a new array having a specified `shape` and filled with ones.
203203

204204
- **dtype**: _Optional\[ <dtype> ]_
205205

206-
- output array data type. Default: `None`.
206+
- output array data type. If `dtype` is `None`, the output array data type must be the default floating-point data type. Default: `None`.
207207

208208
#### Returns
209209

@@ -243,7 +243,7 @@ Returns a new array having a specified `shape` and filled with zeros.
243243

244244
- **dtype**: _Optional\[ <dtype> ]_
245245

246-
- output array data type. Default: `None`.
246+
- output array data type. If `dtype` is `None`, the output array data type must be the default floating-point data type. Default: `None`.
247247

248248
#### Returns
249249

spec/API_specification/data_types.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,28 @@
66
77
A conforming implementation of the array API standard must provide and support the following data types.
88

9+
.. note::
10+
11+
Data types ("dtypes") are objects that can be used as `dtype` specifiers in functions and methods (e.g., `zeros((2, 3), dtype=float32)`). A conforming implementation may add methods or attributes to data type objects; however, these methods and attributes are not included in this specification.
12+
13+
.. note::
14+
15+
Implementations may provide other ways to specify data types (e.g.,
16+
`zeros((2, 3), dtype='f4')`); however, these are not included in this specification.
17+
918
A conforming implementation of the array API standard may provide and support additional data types beyond those described in this specification.
1019

20+
A conforming implementation of the array API standard must define a default floating-point data type (either `float32` or `float64`).
21+
1122
.. note::
1223

13-
These dtypes are objects that can be used as dtype specifiers in functions and methods (e.g., `zeros((2, 3), dtype=float32)`). A conforming implementation may add methods or attributes to dtype objects; these are not part of this specification however.
24+
The default floating-point data type should be clearly defined in a conforming library's documentation.
25+
26+
A conforming implementation of the array API standard must define a default data type for an array index (either `int32` or `int64`).
1427

1528
.. note::
1629

17-
Implementations may provide others ways to specify dtypes (e.g.,
18-
`zeros((2, 3), dtype='f4')`); these are not part of this specification however.
30+
The default array index data type should be clearly defined in a conforming library's documentation.
1931

2032

2133
## bool

0 commit comments

Comments
 (0)