You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns a dictionary of array library capabilities.
6690
-
6691
-
The dictionary must contain the following keys:
6692
-
6693
-
- `"boolean indexing"`: boolean indicating whether an array library supports boolean indexing. If a conforming implementation fully supports boolean indexing in compliance with this specification (see :ref:`indexing`), the corresponding dictionary value must be ``True``; otherwise, the value must be ``False``.
6694
-
- `"data-dependent shapes"`: boolean indicating whether an array library supports data-dependent output shapes. If a conforming implementation fully supports all APIs included in this specification (excluding boolean indexing) which have data-dependent output shapes, as explicitly demarcated throughout the specification, the corresponding dictionary value must be ``True``; otherwise, the value must be ``False``.
Returns a dictionary containing default data types.
6737
-
6738
-
The dictionary must have the following keys:
6739
-
6740
-
- `"real floating"`: default real floating-point data type.
6741
-
- `"complex floating"`: default complex floating-point data type.
6742
-
- `"integral"`: default integral data type.
6743
-
- `"indexing"`: default array index data type.
6744
-
6745
-
Dictionary values must be the corresponding data type object.
6746
-
6747
-
Parameters
6748
-
----------
6749
-
device: Optional[device]
6750
-
device for which to return default data types. If ``device`` is ``None``, the returned data types must be the default data types for the current device; otherwise, the returned data types must be default data types specific to the specified device. Default: ``None``.
6751
-
6752
-
.. note::
6753
-
Some array libraries have the concept of a device context manager, allowing library consumers to manage the current device context. When ``device`` is ``None``, libraries supporting a device context should return the default data types for the current device. For libraries without a context manager or supporting only a single device, those libraries should return the default data types for the default device.
Returns a dictionary of supported *Array API* data types.
6704
+
Returns a namespace with Array API namespace inspection utilities.
6775
6705
6776
-
.. note::
6777
-
While specification-conforming array libraries may support additional data types which are not present in this specification, data types which are not present in this specification should not be included in the returned dictionary.
6778
-
6779
-
.. note::
6780
-
Specification-conforming array libraries must only return supported data types having expected properties as described in :ref:`data-types`. For example, if a library decides to alias ``float32`` as ``float64``, that library must not include ``float64`` in the dictionary of supported data types.
6781
-
6782
-
Parameters
6783
-
----------
6784
-
kind: Optional[Union[str, Tuple[str, ...]]]
6785
-
data type kind.
6786
-
6787
-
- If ``kind`` is ``None``, the function must return a dictionary containing all supported Array API data types.
6788
-
6789
-
- If ``kind`` is a string, the function must return a dictionary containing the data types belonging to the specified data type kind. The following data type kinds must be supported:
6790
-
6791
-
- ``'bool'``: boolean data types (e.g., ``bool``).
6792
-
- ``'signed integer'``: signed integer data types (e.g., ``int8``, ``int16``, ``int32``, ``int64``).
- ``'integral'``: integer data types. Shorthand for ``('signed integer', 'unsigned integer')``.
6795
-
- ``'real floating'``: real-valued floating-point data types (e.g., ``float32``, ``float64``).
6796
-
- ``'complex floating'``: complex floating-point data types (e.g., ``complex64``, ``complex128``).
6797
-
- ``'numeric'``: numeric data types. Shorthand for ``('integral', 'real floating', 'complex floating')``.
6798
-
6799
-
- If ``kind`` is a tuple, the tuple specifies a union of data type kinds, and the function must return a dictionary containing the data types belonging to at least one of the specified data type kinds.
6800
-
6801
-
Default: ``None``.
6802
-
device: Optional[device]
6803
-
device for which to return supported data types. If ``device`` is ``None``, the returned data types must be the supported data types for the current device; otherwise, the returned data types must be supported data types specific to the specified device. Default: ``None``.
6804
-
6805
-
.. note::
6806
-
Some array libraries have the concept of a device context manager, allowing library consumers to manage the current device context. When ``device`` is ``None``, libraries supporting a device context should return the supported data types for the current device. For libraries without a context manager or supporting only a single device, those libraries should return the supported data types for the default device.
6706
+
See :ref:`inspection` for a list of inspection APIs.
6807
6707
6808
6708
Returns
6809
6709
-------
6810
-
out: DataTypes
6811
-
a dictionary containing supported data types.
6812
-
6813
-
.. note::
6814
-
Dictionary keys must only consist of canonical names as defined in :ref:`data-types`.
6710
+
out: Info
6711
+
An object containing Array API namespace inspection utilities.
6815
6712
6816
6713
Notes
6817
6714
-----
6715
+
The returned object may be either a namespace or a class, so long as an Array API user can access inspection utilities as follows:
Returns a list of supported devices which are available at runtime.
6831
-
6832
-
Returns
6833
-
-------
6834
-
out: List[device]
6835
-
a list of supported devices.
6717
+
::
6836
6718
6837
-
Notes
6838
-
-----
6839
-
Each device object (see :ref:`device-support`) in the list of returned devices must be an object which can be provided as a valid keyword-argument to array creation functions.
6840
-
6841
-
Notes
6842
-
-----
6719
+
info = xp.__array_namespace_info__()
6720
+
info.capabilities()
6721
+
info.devices()
6722
+
info.dtypes()
6723
+
info.default_dtypes()
6724
+
# ...
6843
6725
6844
6726
.. versionadded: 2023.12
6845
6727
6846
6728
"""
6847
6729
6848
6730
@abstractmethod
6849
-
def__call__(self, /) ->list[TDevice]: ...
6731
+
def__call__(self, /) ->Info: ...
6850
6732
6851
6733
6852
6734
@runtime_checkable
@@ -8124,21 +8006,6 @@ class unstack[TArray: _array](Protocol):
0 commit comments