使用pycharm时报错:Cannot find reference ‘data‘ in ‘__init__.py‘

 # # #  使用pycharm时报错:Cannot find reference 'data' in '__init__.py' 

解决办法:

  • 将data导入模块
import torch.utils.data
  •   直接import DataLoader
from torch.utils.data import DataLoader
train_loader = torch.utils.data.DataLoader(train_data, batch_size=64,
                                          shuffle=True, num_workers=2)
test_loader = torch.utils.data.DataLoader(test_data, batch_size=64,
                                          shuffle=True, num_workers=2)

你可能感兴趣的:(机器学习,python,深度学习,人工智能)