import torch
import torch.nn as nn

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

This gives me an error Module 'torch' has no 'device' member i’m using version 1.6
>>> print(torch.__version__)
1.6.0

It was working in Google Colab, also conda is available
if torch.cuda.is_available(): print(True)
True

If i do like this net = net.to("cuda:0") i get no output at all and computer starts freezing
EDIT
I encounter this problem only in visual studio code…
https://github.com/kanedaaaa/mnist-pytorch/blob/master/models/cnn.py 36 here is the code, very simple cnn model