How to disable CUDNN in Libtorch

I am using the libtorch C++ API. How can I programatically disable CUDNN for testing purposes?

I think this should work:

at::globalContext().setUserEnabledCuDNN(false);

I am doing a quick test with torch::conv2d on a simple RGB image, but whether i enable or disable CUDNN, the runtime seems to be the same.

torch::cuda::cudnn_is_available() is true

EDIT:

No CUDNN is faster, just needed to run more iterations and take an average

cudnn_is_available() would not return False, if you disable the usage of cuDNN as in fact it’s still available.
You can profile the code via e.g. Nsight Systems or the PyTorch profiler to see the kernels.