Torch.utils has no module 'data'

Hi,

When I try to load custom data, I write the code below:

input=Variable(torch.randn(1000,1,32,32))
target=Variable(torch.randn(1000,10,1,1))
trainset=torch.utils.data.TensorDataset(input, target)
trainloader = torch.utils.data.DataLoader(input, batch_size=4, shuffle=True, num_workers=2)

But when I run it, there is an error:

trainset=torch.utils.data.TensorDataset(input, target)

AttributeError: ‘module’ object has no attribute ‘data’

I have check the torch version: 0.1.11.4

Can anyone help me?

Thanks.

import torch.utils.data
import torchvision
input = torch.randn(1000, 1, 32, 32) target = torch.randn(1000, 10, 1, 1)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=4, shuffle=True, num_workers=2)

Thanks. Your answer helps.

I suppose I have imported torch so that I donot need to import torch.utils.data…