Get a cpu version model without changing the cuda model itself

I use, ...) to save the cuda model to cpu torchscript. My problem is that model.cpu() changes the model from cuda to cpu, while, I need the cuda model un-changed. Is there a function like convert_to_cpu(model) that returns a cpu model without changing the model itself? Thanks.

I don’t think there is an out-of-place method to transfer the model to another device, but in case your GPU has enough memory left you could create a copy.deepcopy of the GPU model and transfer the copy to the CPU only.

@ptrblck Thanks for your reply. I will try it.