Check GPU Memory Usage from Python

You will need to install nvidia-ml-py3 library in python (pip install nvidia-ml-py3) which provides the bindings to NVIDIA Management library.

Here is the code snippet:

Thats it!