AttributeError: module 'torch.utils.data' has no attribute 'Dataloader'
时间: 2023-11-11 21:06:23 浏览: 232
AttributeError: module 'tensorflow.compat.v1' has no attribute '
这个错误提示是因为在调用 `torch.utils.data.Dataloader` 时,拼写错误,应该是 `torch.utils.data.DataLoader`。正确的代码应该是:
```python
from torch.utils.data import DataLoader
dataloader = DataLoader(dataset, batch_size=32, shuffle=True)
```
阅读全文