fn
promote_types
→DTypepromote_types(a_dtype: dtype, b_dtype: dtype)Compute the joint promotion of two dtypes.
Operates on dtype objects directly (no tensor required). Combines the two dtypes according to the standard kind/width ordering: higher kind (bool int float complex) wins outright, and ties in kind are broken by the wider bit-width.
Parameters
a_dtypeDTypeFirst dtype.
b_dtypeDTypeSecond dtype.
Returns
DTypeThe dtype that values of either input dtype would be promoted to in a binary operation.
Notes
With kind(d) and width(d) denoting the kind and bit-width
of a dtype:
The relation is symmetric (up to ties) and commutative on the output dtype.
Examples
>>> import lucid
>>> lucid.promote_types(lucid.int32, lucid.float32)
lucid.float32
>>> lucid.promote_types(lucid.int8, lucid.int64)
lucid.int64