chenyuntc / pytorch-book

PyTorch tutorials and fun projects including neural talk, neural style, poem writing, anime generation (《深度学习框架PyTorch:入门与实战》)
MIT License
12.11k stars 3.74k forks source link

AttributeError: module 'torch.utils' has no attribute 'data' #208

Open tkp30 opened 4 years ago

tkp30 commented 4 years ago

当我执行这里的诗歌生成代码时,出现了一个问题:

Traceback (most recent call last):
  File "C:\Users\朋友的朋\Desktop\诗歌生成\main.py", line 259, in <module>
    train()
  File "C:\Users\朋友的朋\Desktop\诗歌生成\main.py", line 137, in train
    dataloader = t.utils.data.DataLoader(data,
AttributeError: module 'torch.utils' has no attribute 'data'

不知道什么意思,求指教。

GarveyZ commented 3 years ago

先看一下torch包中存不存在data这个方法。 如果不存在,重新安装torch 如果存在,看一下是不是torch没有声明。。。