How to tell PyTorch to not use the GPU?

Is there a way to tell PyTorch to not use the GPU? I want to do some profiling that would be easier done on the CPU side.

Unless you don’t push your tensors and modules to GPU via .cuda() or .to("cuda") all computations will be done on CPU per default.