Pycharm can not find reference device in __init__ when I use pytorch 1.0

I am using python IDE pycharm to write pytorch code. But I get lots of hints abou “can not find reference device in init”. I just don’t know how to fix that.

1 Like

Hi,

Could you give more details? A small code sample to reproduce the problem and the exact stack trace that pycharm gives you please?

Thand you very much for your reply!
There are just many underlines in my pycharm projects. Such as the following:
image

And the IDE gives me many hints like: Can not find reference ‘stack’ in init.py.
And there many hints like this in my pycharm projects. For example, torch.device,torch.float, torch.double…

It’s the same problem as with Pytorch version 0.4.0.
See https://github.com/pytorch/pytorch/issues/7318.
The proposed solution is here https://github.com/pytorch/pytorch/pull/8845

Thanks for your reply! Has this issue been fixed yet?

Not yet, I think.
Follow the discussion here to keep up to date