Array API specification for data type functions.
A conforming implementation of the array API standard must provide and support the following data type functions.
(function-broadcast_arrays)=
Broadcasts one or more arrays against one another.
-
arrays: Sequence[ <array> ]
- arrays to broadcast.
-
out: List[ <array> ]
- a list of broadcasted arrays. Each array must have the same shape. Each array must have the same dtype as its corresponding input array.
(function-broadcast_to)=
Broadcasts an array to a specified shape.
-
x: <array>
- array to broadcast.
-
shape: Tuple[int, ...]
- array shape. Must be compatible with
x(see {ref}broadcasting).
- array shape. Must be compatible with
-
out: <array>
- an array having a specified shape. Must have the same data type as
x.
- an array having a specified shape. Must have the same data type as
- if the array is incompatible with the specified shape (see {ref}
broadcasting).
(function-can_cast)=
Determines if one data type can be cast to another data type according {ref}type-promotion rules.
-
from_: Union[ <dtype>, <array>]
- input data type or array from which to cast.
-
to: <dtype>
- desired data type.
-
out: bool
Trueif the cast can occur according to {ref}type-promotionrules; otherwise,False.
(function-finfo)=
Machine limits for floating-point data types.
-
type: Union[ <dtype>, <array> ]
- the kind of floating-point data-type about which to get information.
-
out: <finfo object>
-
an object having the following attributes:
- bits: int
- number of bits occupied by the floating-point data type.
- eps: float
- difference between 1.0 and the next smallest representable floating-point number larger than 1.0 according to the IEEE-754 standard.
- max: float
- largest representable number.
- min: float
- smallest representable number.
- smallest_normal: float
- smallest positive floating-point number with full precision.
- bits: int
-
(function-iinfo)=
Machine limits for integer data types.
-
type: Union[ <dtype>, <array> ]
- the kind of integer data-type about which to get information.
-
out: <iinfo object>
-
a class with that encapsules the following attributes:
- bits: int
- number of bits occupied by the type
- max: int
- largest representable number.
- min: int
- smallest representable number.
- bits: int
-
(function-result_type)=
Returns the dtype that results from applying the type promotion rules
(see {ref}type-promotion) to the arguments.
If provided mixed dtypes (e.g., integer and floating-point), the returned dtype will be implementation-specific.
-
arrays_and_dtypes: Sequence[ Union[ <array>, <dtype> ] ]
- input arrays and dtypes.
-
out: <dtype>
- the dtype resulting from an operation involving the input arrays and dtypes.