Question about tensors conversion

Hi, I am trying to understand how the conversion of tensors happens in PyTorch.

x = torch.tensor([1, 2, 45896213, 5584700])
y  = x.type(torch.int8)
print(y)
tensor([ 1,  2, 21, 60], dtype=torch.int8)

so, my questions are:

  1. why this piece of code does not raise any conversion errors.
  2. why I am getting 21 and 60
    Thanks.

45896213 % 256 = 21

can’t comment about error, it is debatable. note that there may be some valid uses of truncation and size compression, but check for out of range values is relatively expensive.