Fixed bug in tools.py for NVidia GPUs