The missing puzzle about torch::cuda::cudnn_is_available()

I have been battering my head about it, why isn’t the method torch::cuda::cudnn_is_available() viewable in my code while I can do this torch::Device device(torch::kCUDA); load models and run inference ?

Turns out, you not only have to include
#include <torch/script.h>
But also:
#include <torch/torch.h>

Good luck,

Please always include <torch/torch.h> when using libtorch.