-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Closed
Labels
module: type promotionRelated to semantics of type promotionRelated to semantics of type promotiontriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🐛 Bug
Hi, I found a strange type properties in math function like torch.add, torch.mul etc.
x_tensor = torch.ones((3, ), dtype=torch.int8)
y_tensor = torch.tensor(1, dtype=torch.float64)
out = torch.mul(x_tensor, y_tensor) # torch.float64
x_tensor = torch.ones((3, ), dtype=torch.int8)
y_tensor = torch.tensor(1, dtype=torch.int64)
out = torch.mul(x_tensor, y_tensor) # torch.int8
x_tensor = torch.ones((3, 3), dtype=torch.int8)
y_tensor = torch.ones((3, 3), dtype=torch.int64)
out = torch.mul(x_tensor, y_tensor) # torch.int64
x_tensor = torch.ones((3, 3), dtype=torch.int8)
out = torch.mul(x_tensor, 9223372036854775807) # torch.int8
Expected behavior
I think in each case the output tensor should be cast the higher priority dtype.
Environment
- PyTorch Version (e.g., 1.0): 1.9.0
- OS (e.g., Linux): mac os
- How you installed PyTorch (
conda
,pip
, source): pip install - Python version: 3.9.0
Ldpe2G
Metadata
Metadata
Assignees
Labels
module: type promotionRelated to semantics of type promotionRelated to semantics of type promotiontriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module