The notebook was running on Colab without GPU. Modules from torch.data (not using multiple workers) were used. Similarly tf.data modules were used for tensorflow (now that i think about this, prefetching here might be playing a role in this). in short, same code as above.