Thanks for the quick reply!
When i profile the train script with torch.utils.bottleneck with a single batch of size 24 and setting num_workers = 0, i get this output. So besidesrun_backward the __getitem__ part seems to consume time. When i profile only the Dataloader, i can see that almost the whole time consumed in the _getitem_ function is by PIL image open/convert operations…
Is there anything i can do to make them faster and what could be the reason that increasing num_workers does not help ?
ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     1   24.711   24.711   24.711   24.711 {method 'run_backward' of 'torch._C._EngineBase' objects}
  6297    7.289    0.001    7.289    0.001 {method 'decode' of 'ImagingDecoder' objects}
    87    3.099    0.036    3.099    0.036 {built-in method conv2d}
     1    2.896    2.896    5.299    5.299 \models\DCCA_sparse_networks.py:373(__call__)
    48    2.000    0.042    2.000    0.042 {method 'resize' of 'ImagingCore' objects}
    86    1.983    0.023    1.983    0.023 {method 'to' of 'torch._C._TensorBase' objects}
 36871    1.910    0.000    1.910    0.000 {built-in method matmul}
    48    1.321    0.028    1.321    0.028 {method 'copy' of 'ImagingCore' objects}
    24    0.741    0.031   12.152    0.506 \dataloaders\own_dataset_loader.py:100(__getitem__)
     4    0.450    0.112    0.450    0.112 {built-in method conv_transpose2d}
  1001    0.333    0.000    0.333    0.000 {built-in method io.open_code}
160/158    0.295    0.002    0.298    0.002 {built-in method _imp.create_dynamic}
     2    0.293    0.146    0.293    0.146 {built-in method symeig}
    33    0.235    0.007    0.235    0.007 {method 'uniform_' of 'torch._C._TensorBase' objects}
    37    0.222    0.006    0.222    0.006 {method 'normal_' of 'torch._C._TensorBase' objects}