Compatibility of tensor types

Good afternoon! I have a question why when executing the following code

import torch
a = torch.tensor([1, 2, 3], dtype = torch.float32)
b = torch.tensor([1, 2, 3], dtype = torch.int)
print(a + b)

I get an error, but when I run other code

import torch
a = torch.tensor([1, 2, 3], dtype = torch.float32)
print(a + int(1))

there is no error and the code works correctly?
I noticed that you can only add tensors of one type. Why is this necessary?

It isn’t and indeed PyTorch 1.3 introduced type promotion and make the first work, too.

Thank you very much! I’m using PyTorch 0.4 and it’s not there. I will be updated.