Reputation: 13
I have examples with size 2x8x8 as tensor and I'm using PyTorch Dataloader for them. But now I want to add an additional 1 dim tensor with size 1 (a single number) as input too.
So I have two input parameters for the neural network, a multidimensional for convolutional layers and an additional one that I will concatenate later.
Probably I could use two dataloader, for every tensor shape one, but than I could not shuffle them.
How can I use a single PyTorch Dataloader for this two different input tensors?
Upvotes: 0
Views: 572
Reputation: 3563
This is not about the dataloader, this should be done in the your dataset. Implement your own dataset by making it inherit from torch.util.data.Dataset
(you need to implement __len__
and __getitem__
). Make your __getitem__
method return both your tensors, and you should be fine.
You can follow this tutorial if you need.
Upvotes: 1