Overflow when unpacking long - Pytorch
I am running the following code 

import torch
from __future__ import print_function
x = torch.empty(5, 3)
print(x)


on an Ubuntu machine in CPU mode, which gives me following error, what would be the reason and how to fix

      x = torch.empty(5, 3)
----&gt; print(x)

/usr/local/lib/python3.6/dist-packages/torch/tensor.py in __repr__(self)
     55         # characters to replace unicode characters with.
     56         if sys.version_info &gt; (3,):
---&gt; 57             return torch._tensor_str._str(self)
     58         else:
     59             if hasattr(sys.stdout, 'encoding'):

/usr/local/lib/python3.6/dist-packages/torch/_tensor_str.py in _str(self)
    216             suffix = ', dtype=' + str(self.dtype) + suffix
    217 
--&gt; 218         fmt, scale, sz = _number_format(self)
    219         if scale != 1:
    220             prefix = prefix + SCALE_FORMAT.format(scale) + ' ' * indent

/usr/local/lib/python3.6/dist-packages/torch/_tensor_str.py in _number_format(tensor, min_sz)
     94     # TODO: use fmod?
     95     for value in tensor:
---&gt; 96         if value != math.ceil(value.item()):
     97             int_mode = False
     98             break

RuntimeError: Overflow when unpacking long


Since, torch.empty() gives uninitialized memory, so you may or may not get a large value from it. Try 

x = torch.rand(5, 3)
print(x)


this would give the response.
