Ajinkya_Ambatwar:

The torch DataLoader wrapper does not support variable length data per sample if we use num_workers


I don’t think this behavior depends on the number of workers, but the default collate_fn would fail to create a single batch using inputs with different shapes.
If you want to apply a custom creation of the batch you could write a custom collate_fn and pass it to the DataLoader.



 Ajinkya_Ambatwar:

it takes forever to return anything, probably it didn’t work at all.
Is this expected?


I don’t think it’s expected to take “forever” so I would guess that the multiprocessing used in the DataLoader and your custom multiprocessing approach might block each other / hang etc.