Do you mean to get the GPU index of the currently used device? In this case you are looking for torch.cuda.current_device().
If you want all the GPU indexes you can do something like range(numb_gpu) as NVIDIA GPUs are numbered from 0 to N-1 (with N GPUs).
As an additiona note I don’t understand your code, because numb_gpu is an int but you are iterating on it with a for loop, so this should throw an error.