Looking for Example to compare cpu vs gpu

When I compare pytorch on cpu and gpu in two use cases of mine the gpu is always a bit slower. I would like to have a code example I can just execute myself where the gpu is supposed to beat the cpu. If it works I want to use it to improve my code. However I wasn’t able to find any pytorch code where a comparsion between cpu and gpu is implemented, except for 1-2 that needed very big image database downloads.

Does someone have a link/code I could use?

You could use a torchvision model (e.g. pick a ResNet) and compare the performance using random input tensors (e.g. torch.randn(64, 3, 224, 224)).