Torch.empty doesn't work

And yes, that is correct. You can apply operations but can’t print the value.

This happens because torch.empty initializes your tensor with “un-initialized” data. Some of this data happened to have very, very large float values. The tensor printing code attempts to convert this number to an int (to see if it would be better printed as an integer), causing an overflow because there is a limit on how large a python int/long can be.

2 Likes