diff --git a/src/layer.cpp b/src/layer.cpp index cca3e77bf1fe..3c40cbd67ca2 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -362,9 +362,16 @@ class Layer_final : public Layer #if NCNN_VULKAN if (layer_vulkan) { - int ret = layer_vulkan->create_pipeline(opt); - get_layer_properties(); - return ret; + if (vkdev) + { + int ret = layer_vulkan->create_pipeline(opt); + get_layer_properties(); + return ret; + } + + // fallback to cpu layer + delete layer_vulkan; + layer_vulkan = 0; } #endif // NCNN_VULKAN