torch.device

问题:

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

AttributeError: 'module' object has no attribute 'device'

torch.device was introduced in PyTorch 0.4.

你可能感兴趣的:(pytorch,python,人工智能)