Transforms.Resize()

After adding the transforms.Resize(), Why the training of model gets slowly?

Resize is executed on the CPU. If you see a significant slowdown, your CPU might suffer from this additional workload although I would assume the operation isn’t particularly expensive (but might be wrong).

Is Resize always executed on the CPU? It seems common to create a list of transforms which includes a Resize and pass it to a method (e.g. torchvision.datasets.CIFAR10) to create a dataset. Then pass the dataset to a torch.utils.data.DataLoader. Lastly we iterate over the dataloader object and often move batches .to(device).
Seems like this paradigm always has the transforms running on CPU. Is this what we normally want? Is it not faster to run the transforms on the GPU?

It depends on your use case, but the standard approach is to use multiprocessing allowing the workers to load and process the next batch(es) while the GPU is busy training the model. If your GPU is underutilized you could check e.g. DALI, which also provides GPU loading and processing.