@@ -52,5 +52,78 @@ Requests to create an instance of array object for these types on devices where
52
52
53
53
.. TODO: provide a note on support for sub-normal numbers
54
54
55
- Data type objects are instances of :py:class: `numpy. dtype ` object, and support equality comparison by implementing
55
+ Data type objects are instances of :py:class: `dtype ` object, and support equality comparison by implementing
56
56
special method :meth: `__eq__ `.
57
+
58
+ .. py :class :: dtype
59
+
60
+ Same as :py:class: `numpy.dtype `
61
+
62
+ .. py :method :: __eq__
63
+
64
+ Check if data-type instances are equal.
65
+
66
+
67
+ Default integral data type
68
+ --------------------------
69
+
70
+ The default integral data type is :attr: `int64 ` for all supported devices.
71
+
72
+ Default indexing data type
73
+ --------------------------
74
+
75
+ The default indexing data type is :attr: `int64 ` for all supported devices.
76
+
77
+ Default real floating-point data type
78
+ -------------------------------------
79
+
80
+ The default real floating-point type depends on the capabilities of device where array is allocated.
81
+ If the device support double precision floating-point types, the default real floating-point type
82
+ is :attr: `float64 `, otherwise :attr: `float32 `.
83
+
84
+ Make sure to select an appropriately capable device for an application that requires use of double
85
+ precision floating-point type.
86
+
87
+ Default complex floating-point data type
88
+ ----------------------------------------
89
+
90
+ Like for the default real floating-point type, the default complex floating-point type depends on
91
+ capabilities of device. If the device support double precision real floating-point types, the default
92
+ complex floating-point type is :attr: `complex128 `, otherwise :attr: `complex64 `.
93
+
94
+
95
+ Querying default data types programmatically
96
+ --------------------------------------------
97
+
98
+ The data type can be discovered programmatically using Array API :ref: `inspection functions <dpctl_tensor_inspection >`:
99
+
100
+ .. code-block :: python
101
+
102
+ from dpctl
103
+ from dpctl import tensor
104
+
105
+ device = dpctl.select_default_device()
106
+ # get default data types for default-selected device
107
+ default_types = tensor.__array_namespace_info__().default_dtypes(device)
108
+ int_dt = default_types[" integral" ]
109
+ ind_dt = default_types[" indexing" ]
110
+ rfp_dt = default_types[" real floating" ]
111
+ cfp_dt = default_types[" complex floating" ]
112
+
113
+
114
+ Type promotion rules
115
+ --------------------
116
+
117
+ Type promotion rules govern behavior of array library when its function does not have
118
+ dedicated implementation for the data type(s) of the input array(s).
119
+
120
+ In such a case, input arrays may be cast to data types for which dedicated implementation
121
+ exists. This is what happens when function :data: `sin ` is applied to array of integral values.
122
+
123
+ Type promotion rules used in :py:mod: `dpctl.tensor ` are consistent with the
124
+ Python Array API specification's `type promotion rules <https://data-apis.org/array-api/latest/API_specification/type_promotion.html >`_
125
+ for devices that support double precision floating-point type.
126
+
127
+
128
+ For devices that do not support double precision floating-point type, the type promotion rule is
129
+ truncated by removing nodes corresponding to unsupported data types and edges that lead to them.
0 commit comments