GPU listed in physical devices in Tensorflow, but not in logical devices
The reason why GPU was listed in physical devices but not in logical devices was because I had this line in my script. This line made my GPU not visible to the runtime.

tf.config.set_visible_devices([], "GPU")
I am trying to run inference for a Tensorflow model on GPU, but it is using CPU. I can confirm it is using CPU as the inference time is very large and nvidia-smi shows no python process.
To debug this, I listed the physical and logical devices in Tensorflow. I can see that physical devices list contains GPU, but the logical devices list doesn't contain GPU. What can I do to fix this and run my model inference on GPU?
I am using Tensorflow 2.4.4.

tf.config.list_physical_devices()
[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU'),
PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
tf.config.list_logical_devices()
[LogicalDevice(name='/device:CPU:0', device_type='CPU')]