LoginSignup
0
1

More than 3 years have passed since last update.

AttributeError: module ‘torch.utils’ has no attribute ‘data’の解決法

Posted at

実行環境

  • Windows10 Home
  • torch 1.1.0

PytorchでDataLoaderを使おうとしたところ以下のエラーが発生

実行したプログラム
import torch

torch.utils.data.DataLoader(
    dataset = dataset,
    batch_size = 100,
    shuffle = True,
    num_workers = 0)
エラー文
AttributeError: module ‘torch.utils’ has no attribute ‘data’

解決策

import torchではなく、import torch.utils.dataとすると解決する。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1