`torch.result_type` does not define result of most cross-integral type operations
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the failing calls through array_api_compat.torch.result_type, using the integer and unsigned-integer combinations listed in the issue. Compare the results with strict.result_type and confirm that the standard-defined combinations no longer raise the reported promotion error.
Written by the indexing model from the issue text.
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.
- Dominant language
- Python
- Stars
- 131
- Forks
- 49
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from data-apis/array-api-compat
-
blocked by upstream
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
data-apis/array-api-compat#439 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
data-apis/array-api-compat#395 · 2 comments ·
-
Release 1.16 Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
data-apis/array-api-compat#476 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
data-apis/array-api-compat#473 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
data-apis/array-api-compat#465 · 3 comments ·
All issues in data-apis/array-api-compat
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100