DataLoader batch first

The dataloader is just a utility used to work with the dataset class (passed as the first argument to the dataloader) Check out the dataset class that you pass to the dataloader. That would be where you’d have coded in the dimensions of the data returned by dataset class and thus your dataloader.

If for whatever reason this dataset class isn’t accessible to you; check out the collate function : How to create a dataloader with variable-size input and input.permute(1, 0, 2) your batches there.

Check out this useful answers on using RNNs with PyTorch https://stackoverflow.com/questions/49466894/how-to-correctly-give-inputs-to-embedding-lstm-and-linear-layers-in-pytorch/49473068#49473068

1 Like