Open
Description
The result_type
of many int
/uint
and uint
/uint
combinations are defined by the standard, but torch.result_type
does not support them. For instance:
from array_api_compat import torch
torch.result_type(torch.uint16, torch.uint32)
# RuntimeError: Promotion for uint16, uint32, uint64 types is not supported, attempted to promote UInt16 and UInt32
from array_api_compat import numpy, torch
import array_api_strict as strict
for xp in [numpy, torch, dask, jax, tensorflow]:
dtypes = ["int8", "int16", "int32", "int64",
"uint8", "uint16", "uint32", "uint64"]
for dtype_a in dtypes:
for dtype_b in dtypes:
try:
res = xp.result_type(getattr(xp, dtype_a), getattr(xp, dtype_b))
except:
try:
res = strict.result_type(getattr(strict, dtype_a), getattr(strict, dtype_b))
print(f"`result_type({dtype_a}, {dtype_b})` is defined by the standard, but torch does not support it.")
except:
pass
# print(f"`result_type({dtype_a}, {dtype_b})` not defined by the standard.")
`result_type(int8, uint16)` is defined by the standard, but torch does not support it.
`result_type(int8, uint32)` is defined by the standard, but torch does not support it.
`result_type(int16, uint16)` is defined by the standard, but torch does not support it.
`result_type(int16, uint32)` is defined by the standard, but torch does not support it.
`result_type(int32, uint16)` is defined by the standard, but torch does not support it.
`result_type(int32, uint32)` is defined by the standard, but torch does not support it.
`result_type(int64, uint16)` is defined by the standard, but torch does not support it.
`result_type(int64, uint32)` is defined by the standard, but torch does not support it.
`result_type(uint8, uint16)` is defined by the standard, but torch does not support it.
`result_type(uint8, uint32)` is defined by the standard, but torch does not support it.
`result_type(uint8, uint64)` is defined by the standard, but torch does not support it.
`result_type(uint16, int8)` is defined by the standard, but torch does not support it.
`result_type(uint16, int16)` is defined by the standard, but torch does not support it.
`result_type(uint16, int32)` is defined by the standard, but torch does not support it.
`result_type(uint16, int64)` is defined by the standard, but torch does not support it.
`result_type(uint16, uint8)` is defined by the standard, but torch does not support it.
`result_type(uint16, uint32)` is defined by the standard, but torch does not support it.
`result_type(uint16, uint64)` is defined by the standard, but torch does not support it.
`result_type(uint32, int8)` is defined by the standard, but torch does not support it.
`result_type(uint32, int16)` is defined by the standard, but torch does not support it.
`result_type(uint32, int32)` is defined by the standard, but torch does not support it.
`result_type(uint32, int64)` is defined by the standard, but torch does not support it.
`result_type(uint32, uint8)` is defined by the standard, but torch does not support it.
`result_type(uint32, uint16)` is defined by the standard, but torch does not support it.
`result_type(uint32, uint64)` is defined by the standard, but torch does not support it.
`result_type(uint64, uint8)` is defined by the standard, but torch does not support it.
`result_type(uint64, uint16)` is defined by the standard, but torch does not support it.
`result_type(uint64, uint32)` is defined by the standard, but torch does not support it.