Your installed Caffe2 version uses cuDNN but I cannot find the cuDNN libraries. Please set the proper cuDNN prefixes and / or install cuDNN?

Libtorch 1.5.0 can not find the cudnn installed in my computer. I gt the following error using libtorch_v1.5.0_cu92:

-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found CUDA: /usr (found suitable exact version "9.1") 
-- Found OpenCV: /media/zjk/tmp/library/opencv-3.4.1/build (found version "3.4.1") 
-- Found CUDA: /usr (found version "9.1") 
-- Caffe2: CUDA detected: 9.1
-- Caffe2: CUDA nvcc is: /usr/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr
-- Caffe2: Header version is: 9.1
-- Could NOT find CUDNN (missing: CUDNN_LIBRARY_PATH) 
CMake Warning at /media/zjk/tmp/library/temp/libtorch_cu92_v150/libtorch/share/cmake/Caffe2/public/cuda.cmake:109 (message):
  Caffe2: Cannot find cuDNN library.  Turning the option off
Call Stack (most recent call first):
  /media/zjk/tmp/library/temp/libtorch_cu92_v150/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
  /media/zjk/tmp/library/temp/libtorch_cu92_v150/libtorch/share/cmake/Torch/TorchConfig.cmake:40 (find_package)
  CMakeLists.txt:15 (find_package)


-- Autodetected CUDA architecture(s):  6.1 6.1
-- Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61
CMake Error at /media/zjk/tmp/library/temp/libtorch_cu92_v150/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:96 (message):
  Your installed Caffe2 version uses cuDNN but I cannot find the cuDNN
  libraries.  Please set the proper cuDNN prefixes and / or install cuDNN.
Call Stack (most recent call first):
  /media/zjk/tmp/library/temp/libtorch_cu92_v150/libtorch/share/cmake/Torch/TorchConfig.cmake:40 (find_package)
  CMakeLists.txt:15 (find_package)

Here’s my CMakeLists.txt:

cmake_minimum_required(VERSION 3.4)
project(ocr)
set(OpenCV_DIR /media/zjk/tmp/library/opencv-3.4.1/build)
find_package(OpenCV REQUIRED)
set(Torch_DIR /media/zjk/tmp/library/temp/libtorch_cu92_v150/libtorch/share/cmake/Torch) #GPU 1.5.0
find_package(Torch REQUIRED)
add_executable(ocr inference.cpp model.cpp utils.cpp)
target_link_libraries(ocr ${TORCH_LIBRARIES} ${OpenCV_LIBS}) # ${CMAKE_THREAD_LIBS_INIT})

And the environment variables about cuda and cudnn in ~/.bashrc is as follows:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/dai/cuda9/lib64/
export PATH=$PATH:/home/dai/cuda9/bin
export CUDA_HOME=$CUDA_HOME:/home/dai/cuda9
export ORACLE_HOME=/home/dai/library/instantclient_11_2
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
export CUDNN_INCLUDE_DIR=/media/zjk/tmp/library/temp/cuda/include/
export CUDNN_LIB_DIR=/media/zjk/tmp/library/temp/cuda/lib64/
export CUDNN_PATH=/media/zjk/tmp/library/temp/cuda/lib64/libcudnn.so.7
export CUDNN_LIBRARY=/media/zjk/tmp/library/temp/cuda/lib64/libcudnn.so

The project works fine when I built with libtorch_v1.0.1_cu92.
How can I solve this problem? Looking foward to your reply.

I solved this problem by replace
export CUDNN_LIBRARY=/media/zjk/tmp/library/temp/cuda/lib64/libcudnn.so
by
export CUDNN_LIBRARY=/media/zjk/tmp/library/temp/cuda/lib64/