So as I was programming and skimming through the pytorch docs, I stumbled across DataLoader. I learnt a fair bit and continued researching, and then saw a comment on a youtube video covering it, stating that DataLoader actually outputs a list instead of a tensor.
I then used the type() on the iterable data and learnt that this was true, could anyone please help me understand why the DataLoader outputs a list instead of a tensor.
The pytorch
DataLoaderclass has acollate_fnthat processes dataset items into a batch. Using the example from the pytorch documentation, it works like this:If you don't pass a
collate_fn, pytorch automatically usesdefault_collate. The behavior ofdefault_collatedepends on the types from you dataset, defined here.