Hi,
You can use the torch.from_numpy(ndarray) function to convert numpy array from numpy.
If you use it, you will see that int8 is not supported in torch, the error message by the from_numpy function will tell you which types are supported. In your case, I think you want to use the uint8 type (that is supported).
When you use torch.Tensor(ndarray) (which is a shorthand for torch.FloatTensor(ndarray) if you didn’t changed the default tensor type), it will try to build a FloatTensor from the ndarray, which is not an array of float in your case but int8.
If you want to build a tensor of uint8 elements, you will need to build it with the right type: torch.ByteTensor(ndarray).
I would advice using the from_numpy function as it finds the corresponding tensor type itself, while if you directly build the tensor, you will have to specify the type yourself.