Pytorch Model ios deployment

I have made a pytorch model using resnet architecture, I made a model.pt file and I want to use this model file in iOS application. Model is imaga classification model and use CUDA.

Whenever I load this file in iOS my application crashes and gives me this error.

“Could not run ‘aten::empty_strided’ with arguments from the ‘CUDA’ backend. This could be because the operator doesn’t exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit Internal Login for possible resolutions. ‘aten::empty_strided’ is only available for these backends: [CPU, BackendSelect, Named, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, UNKNOWN_TENSOR_TYPE_ID, AutogradMLC, Tracer, Autocast, Batched, VmapMode].”

What is work around for it. Also I want to know if models are using CUDA gpu then can we use them in mobile deployments ?

I guess you might have stored the model directly via torch.save while it was still on the GPU?
If so, you might need to save the scripted model from the CPU so that your iOS application could load it without any CUDA dependency.