Libtorch dlls delayed loading

Pytorch Release ver. 1.10.0
Microsoft Visual Studio Community 2019
The application we are developing has to load the pytorch dlls in a delayed way so that the end user is not forced to install them if he does not need them.
The problem is that we can’t link the pytorch dlls in a delayed way (/DELAYLOAD).
There are two different problems:

  1. linker error
    If I add the c10.dll or torch_cpu.dll in the project properties → linker → input → “Delay Loaded Dlls” I have the following linker errors:

fatal error LNK1194: cannot delay-load ‘c10.dll’ due to import of data symbol '"__declspec (dllimport) struct std :: atomic <struct c10 :: impl :: DeviceGuardImplInterface const *> * c10 :: impl :: device_guard_impl_registry "(_imp? device_guard_impl_registry @ impl @ c10 @@ 3PAU? $ atomic @ PEBUDeviceGuardImplInterface @ impl @ c10 @@@ std @@ A) '; link without /DELAYLOAD:c10.dll

fatal error LNK1194: cannot delay-load ‘torch_cpu.dll’ due to import of data symbol ‘"__declspec(dllimport) struct torch::enumtype::kValid const torch::kValid" (_imp?kValid@torch@@3U0enumtype@1@B)’; link without /DELAYLOAD:torch_cpu.dll

  1. anomaly in runtime
    If I add the dll torch_cuda_cu.dll in the project properties → linker → input → “Delay Loaded Dlls” it happens that the CPU is always used and the GPU is ignored. The function torch::cuda::is_available() returns always false.

Thanks for your help