Trying to implement GPU for Tensorflow using CUDA & cuDNN

I am trying to use CUDA (12.3) & cuDNN (8.9.7) so my Nvidia 4050 RTX is actually used when I train Machine Learning models in my code.

-Installed CUDA 12.3 & cuDNN 8.9.7 (Verified CUDA installation)

  • I have put the cuDNN files in my CUDA 12.3 directory (bin, lib, and libnvvp)
  • I set the env variables with C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\bin as CUDA_PATH and I have put C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\bin & C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\libnvvp into Path (Verified with cmd commands)
  • Set Nvidia drivers up to date
  • installed tensorflow using pip install tensorflow (everything said "Requirment already satisfied)

But even after all this, I ran this program:
import tensorflow as tf
from tensorflow.python.client import device_lib

print(“TensorFlow version:”, tf.version)
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices(‘GPU’)))
print(device_lib.list_local_devices())

if tf.test.gpu_device_name():
print(‘Default GPU Device: {}’.format(tf.test.gpu_device_name()))
else:
print(“Please install GPU version of TensorFlow”)

and its returning that the GPU isnt used:

TensorFlow version: 2.16.1
Num GPUs Available: 0
[name: “/device:CPU:0”
device_type: “CPU”
memory_limit: 268435456
locality {
}
incarnation: 15945025555237357829
xla_global_id: -1
]
Please install GPU version of TensorFlow

Hi @arnavsharma.0914 ,
TensorFlow 2.10 was the last TensorFlow release that supported GPU on native-Windows. Starting with TensorFlow 2.11, you will need to install TensorFlow in WSL2, or install tensorflow-cpu` and, optionally, try the TensorFlow-DirectML-Plugin. For installing WSL2 please refer to this document

Thanks