Kevin_Shen:

even with num_workers=20.


Note that too many workers might slow down your system, so you should test different values for your current setup.
That being said, to avoid the torch.stack call, you could use a BatchSampler 44 to pass a batch of indices to your Dataset.__getitem__, preallocate the final tensor via torch.empty(batch_size, 120, 1024) and copy the tensors into it.