Error:module 'torch' has no attribute 'empty'

I’m not sure, if the mirror might be the issue.
Could you try to re-install it using the latest package?

I have installed pytorch 0.4.0 now, but when I run code :
x = torch.empty(5, 3)
print (x)

it also have errors as follows:

RuntimeError Traceback (most recent call last)
in ()
1 x = torch.empty(5, 3)
----> 2 print ( x )

/home/user/anaconda3/lib/python3.5/site-packages/torch/tensor.py in repr(self)
55 # characters to replace unicode characters with.
56 if sys.version_info > (3,):
—> 57 return torch._tensor_str._str(self)
58 else:
59 if hasattr(sys.stdout, ‘encoding’):

/home/user/anaconda3/lib/python3.5/site-packages/torch/_tensor_str.py in _str(self)
216 suffix = ‘, dtype=’ + str(self.dtype) + suffix
217
–> 218 fmt, scale, sz = _number_format(self)
219 if scale != 1:
220 prefix = prefix + SCALE_FORMAT.format(scale) + ’ ’ * indent

/home/user/anaconda3/lib/python3.5/site-packages/torch/_tensor_str.py in _number_format(tensor, min_sz)
94 # TODO: use fmod?
95 for value in tensor:
—> 96 if value != math.ceil(value.item()):
97 int_mode = False
98 break

RuntimeError: Overflow when unpacking long

could you help me?

This seems to be a bug when trying to print an empty Tensor.
@richard explained it here.

I see, thank you very much!

adding “python.linting.pylintPath”:“E:\ProgramFiles\Anaconda3\pkgs\pylint-1.8.2-py36_0\Scripts\pylint” in setting.json will help.