Fail to run torch model on Vulkan backend

I compiled torch with vulkan backend, and saved the model with vulkan backend. However, when I do the inference on android device, it throwed the following error:
com.facebook.jni.CppException: Could not run ‘vulkan_prepack::run_conv2d_context’ with arguments from the ‘CPU’ backend.

Please let me know what’s the cause of this issue. Thanks

That error usually means the model or one of its components is still on the CPU backend when Vulkan is expected. Even if you compiled with Vulkan support and saved the model, some ops or parameters might not have been properly transferred to the Vulkan backend before inference. You might want to double-check that you’re calling to (“vulkan”) on the model (or the inputs) before running inference.

Hey there, PyTorch Mobile is deprecated and we have been building ExecuTorch for the past few years. Check it out here: GitHub - pytorch/executorch: On-device AI across mobile, embedded and edge for PyTorch Vulkan support is better on ExecuTorch